Repository: autokey/autokey

Issue #483: #354 fix causes IndexError: string index out of range
Created: 2020-11-29T14:31:04Z
Classification:
Bug
Reproducibility:
Just run this command through autokey.
system.exec_command("fcitx-remote -s **fcitx-keyboard-us")
Version
AutoKey version: 0.95.10
Used GUI (Gtk, Qt, or both):
If the problem is known to be present in more than one version, please list all of those.
Installed via: (PPA, pip3, …). PPA
Linux Distribution: Linux Mint 20
Summary
#354 adds some commands related to this problem. It causes the result.
Expected Results
Nothing happens.
Actual Results
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/autokey/service.py", line 207, in __tryReleaseLock
    self.configManager.lock.release()
RuntimeError: release unlocked lock
2020-11-29 23:28:13,811 ERROR - service - Script error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/autokey/service.py", line 485, in execute
    exec(script.code, scope)
  File "<string>", line 2, in <module>
  File "/usr/lib/python3/dist-packages/autokey/scripting.py", line 497, in exec_command
    if output[-1] == "\n":
IndexError: string index out of range

Duplicate issue #462: Errors started coming after updating Linux Mint Cinnamon 19.3 -> 20
Created: 2020-11-10T22:31:05Z
Classification:
Bug
Reproducibility:
Always
Version
AutoKey version: 0.95.10
Used GUI (Gtk, Qt, or both): both
Installed via: PPA
Linux Distribution: Linux Mint Cinnamon 20
Python ($ python --version): Python 3.6.4
Summary
I have a simple script that opens a directory in the file manager with a hotkey. Example script:
# Enter script code
system.exec_command("nemo /media/mikko/Files/Download")

In Linux Mint Cinnamon 19.3 (and who knows how many versions before that, because I have been using Mint Cinnamon since 2014 and have been always updating) everything worked without problem. In Mint Cinnamon 20:

the script itself works (the directory is opened)
but autokey gives an error (both inside the program log as well as trashing my OS notifications list every time I invoke one of my many scripts).

OS Notifications:


Error Autokey gives:

Actual Results
Here is an attached log file: 2020-11-11_Autokey_error.txt
Three things that interesting/worrying:
Errors 1:
2020-11-11 00:24:44,862 DEBUG - inotify - Adding watch for /home/mikko/.config/autokey/data/Linux cursors/-button
[2020-11-11 00:24:44,862 pyinotify ERROR] add_watch: cannot watch /home/mikko/.config/autokey/data/Linux cursors/-button WD=-1, Errno=No space left on device (ENOSPC)
2020-11-11 00:24:44,862 ERROR - pyinotify - add_watch: cannot watch /home/mikko/.config/autokey/data/Linux cursors/-button WD=-1, Errno=No space left on device (ENOSPC)

Error 2.
(autokey-gtk:305378): Gdk-CRITICAL **: 00:24:45.478: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
2020-11-11 00:24:45,986 ERROR - interface - Got BadWindow error while requesting window information.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/autokey/interface.py", line 1074, in get_window_info
    return self._get_window_info(window, traverse)
  File "/usr/lib/python3/dist-packages/autokey/interface.py", line 1080, in _get_window_info
    new_wm_title = self._try_get_window_title(window)
  File "/usr/lib/python3/dist-packages/autokey/interface.py", line 1128, in _try_get_window_title
    atom = self._try_read_property(window, self.__VisibleNameAtom)
  File "/usr/lib/python3/dist-packages/autokey/interface.py", line 1145, in _try_read_property
    return window.get_property(property_name, 0, 0, 255)
  File "/usr/lib/python3/dist-packages/Xlib/xobject/drawable.py", line 455, in get_property
    r = request.GetProperty(display = self.display,
  File "/usr/lib/python3/dist-packages/Xlib/protocol/rq.py", line 1369, in __init__
    self.reply()
  File "/usr/lib/python3/dist-packages/Xlib/protocol/rq.py", line 1389, in reply
    raise self._error
Xlib.error.BadWindow: <class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x0301eeb5), sequence_number = 3342, major_opcode = 20, minor_opcode = 0
2020-11-11 00:24:46,038 DEBUG - interface - Grabbing hotkey: ['<super>'] 't'
2020-11-11 00:24:46,038 DEBUG - interface - Grabbing hotkey: ['<super>'] 'r'
2020-11-11 00:24:46,038 DEBUG - interface - Grabbing hotkey: ['<super>'] 't'
2020-11-11 00:24:46,039 DEBUG - interface - Grabbing hotkey: ['<super>'] 'r'
2020-11-11 00:24:46,039 DEBUG - interface - Grabbing hotkey: ['<super>'] 't'
2020-11-11 00:24:46,039 DEBUG - interface - Grabbing hotkey: ['<super>'] 'r'
2020-11-11 00:24:46,039 DEBUG - interface - Grabbing hotkey: ['<super>'] 't'
2020-11-11 00:24:46,039 DEBUG - interface - Grabbing hotkey: ['<super>'] 'r'
X protocol error:
<class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x0301eeb5), sequence_number = 3354, major_opcode = 33, minor_opcode = 0
X protocol error:
<class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x0301eeb5), sequence_number = 3355, major_opcode = 33, minor_opcode = 0
X protocol error:
<class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x0301eeb5), sequence_number = 3356, major_opcode = 33, minor_opcode = 0
X protocol error:
<class 'Xlib.error.BadWindow'>: code = 3, resource_id = <class 'Xlib.xobject.resource.Resource'>(0x0301eeb5), sequence_number = 3357, major_opcode = 33, minor_opcode = 0

Error 3. The actual error caused by me pressing the hotkey.
2020-11-11 00:24:52,462 DEBUG - iomediator - Key.CONTROL pressed
2020-11-11 00:24:52,477 DEBUG - iomediator - Key.ALT pressed
2020-11-11 00:24:52,703 DEBUG - service - Raw key: 'd', modifiers: [<Key.ALT: '<alt>'>, <Key.CONTROL: '<ctrl>'>], Key: d
2020-11-11 00:24:52,703 DEBUG - service - Window visible title: 'autokey-gtk --verbose', Window class: 'gnome-terminal-server.Gnome-terminal'
2020-11-11 00:24:52,704 INFO - service - Matched Script "Open Download directory" with hotkey and prompt=False
2020-11-11 00:24:52,704 DEBUG - service - Script runner executing: Script('Open Download directory')
2020-11-11 00:24:52,705 ERROR - service - Ignored locking error in handle_keypress
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/autokey/service.py", line 207, in __tryReleaseLock
    self.configManager.lock.release()
RuntimeError: release unlocked lock
2020-11-11 00:24:52,766 ERROR - service - Script error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/autokey/service.py", line 485, in execute
    exec(script.code, scope)
  File "<string>", line 2, in <module>
  File "/usr/lib/python3/dist-packages/autokey/scripting.py", line 497, in exec_command
    if output[-1] == "\n":
IndexError: string index out of range
2020-11-11 00:24:52,830 DEBUG - iomediator - Key.ALT released
2020-11-11 00:24:52,837 DEBUG - iomediator - Key.CONTROL released

Closing comment (2021-03-11T01:34:37Z): This ought to be closed as a duplicate of #483 @josephj11