Ubuntu – Autokey (autokey-qt) freezes and won’t insert text


Per some suggestions on here and lifehacker, I began using autokey.

It worked great for a week, but as of today it now

  • hangs when I try to enter name new phrases.

  • usually won't close when I push the 'x' in my window manger


  • no longer responds to my abbreviation phrases.

I've added a few phrases and rebooted since my last successful attempt at using it.

Another user reported a similar problem for the gtk version of autokey.

The results of running it from the command line seems to show some exception errors:

Exception in thread KeypressHandler-thread:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
  File "/usr/lib/python2.7/dist-packages/autokey/iomediator.py", line 202, in run
    target.handle_keypress(rawKey, modifiers, key, windowName, windowClass)
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 179, in handle_keypress
    currentInput, windowInfo, True)
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 304, in __checkTextMatches
    if item.check_input(buffer, windowInfo):
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 732, in check_input
    abbr = self._should_trigger_abbreviation(buffer)
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 131, in _should_trigger_abbreviation
    if self.__checkInput(buffer, abbr):
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 144, in __checkInput
    stringBefore, typedAbbr, stringAfter = self._partition_input(buffer, abbr)
  File "/usr/lib/python2.7/dist-packages/autokey/model.py", line 191, in _partition_input
    stringBefore, typedAbbr, stringAfter = currentString.rpartition(abbr)
ValueError: empty separator

Full log here

Any help would be appreciated.

Best Answer

This is my change to the offending code:


def _should_trigger_abbreviation(self, buffer):
    Checks whether, based on the settings for the abbreviation and the given input,
    the abbreviation should trigger.

    @param buffer Input buffer to be checked (as string)
    for abbr in self.abbreviations:
        if abbr == "":
        if self.__checkInput(buffer, abbr):
            return True