autokey / autokey-python2

Legacy Python 2 version of AutoKey, the desktop automation utility for Linux and X11.
GNU General Public License v3.0
207 stars 19 forks source link

Exception in Thread Phrase-thread #35

Closed yafp closed 8 years ago

yafp commented 9 years ago

I can reproduce an exception if i do execute a specific phrase. The exception output is as follows:

Exception in thread Phrase-thread: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 813, in bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 766, in run self.__target(_self.args, *_self.__kwargs) File "/usr/lib/python2.7/site-packages/autokey/service.py", line 383, in execute self.macroManager.process_expansion(expansion) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 55, in process_expansion macro.process(parts) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 100, in process self.do_process(parts, i) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 129, in do_process args = self._get_args(parts[i]) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 93, in _get_args raise Exception("Missing mandatory argument '%s' for macro '%s'" % (k, self.ID)) Exception: Missing mandatory argument 'name' for macro 'script'

To be honest - i dont know where i would need to define a name for the macro script.

I am using 0.90.4

yafp commented 9 years ago

i can for sure paste the script code as well - if needed. Just let me know

josephj11 commented 8 years ago

Sorry it took so long to reply. I spend most of my time on our support list.

We don't currently have any developers who can look at the code and give you a definitive answer or provide a fix.

If you know any Python developers with time on their hands, ... ;)

This sounds a little bit like another bug we had where a system function was upgraded with an additional argument that we hadn't coded for.

I just added to pages to our wiki on Problem Reporting and on Installing from GitHub.

You may want to install the latest version - 0.90.4-1. It had fixes for the above problem - that probably won't help you, but it might.

A full problem report, including a trace would also be very helpful.

One more thought.

Long ago, but maybe after 0.90.4, it was possible to add a macro using the gui in a way that accidentally added a null trigger phrase. This would cause AutoKey to die every time it looked at the list of trigger phrases to see if one had been entered. If you did this, AutoKey would bomb all the time, not just on a particular macro.

If you open a macro like this for editing in the AutoKey main window, you would "see" a blank line as the first trigger phrase. If you have one of those, just delete all your trigger phrases for it and add one back in - remembering to press Enter immediately following entering the string - before clicking on anything else.

This is fixed in 0.90.4-1.

yafp commented 8 years ago

Hi,

first of all - thanks for taking a look. I'll add output with debug logging in the following days.

yafp commented 8 years ago

Now i am late ;)

autokey-gtk -l /usr/lib/python2.7/site-packages/autokey/gtkapp.py:24: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded. from gi.repository import Gtk, Gdk, GObject, GLib /usr/lib/python2.7/site-packages/pyatspi/init.py:17: PyGIWarning: Atspi was imported without specifying a version first. Use gi.require_version('Atspi', '2.0') before import to ensure that the right version gets loaded. from gi.repository import Atspi /usr/lib/python2.7/site-packages/autokey/gtkui/notifier.py:19: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded. from gi.repository import Gtk, Gdk, Notify /usr/lib/python2.7/site-packages/autokey/gtkui/configwindow.py:20: PyGIWarning: GtkSource was imported without specifying a version first. Use gi.require_version('GtkSource', '3.0') before import to ensure that the right version gets loaded. from gi.repository import Gtk, Pango, GtkSource, Gdk, Gio 2015-12-16 20:10:40,506 INFO - root - Initialising application 2015-12-16 20:10:40,522 INFO - root - Initialise global hotkeys 2015-12-16 20:10:40,522 INFO - config-manager - Loading config from existing file: /home/fidel/.config/autokey/autokey.json 2015-12-16 20:10:40,534 INFO - config-manager - Configuration changed - rebuilding in-memory structures 2015-12-16 20:10:40,534 DEBUG - inotify - Adding watch for /home/fidel/Dropbox/Privat/Linux_Settings/Autokey-Textpattern/Key_WindowMovement 2015-12-16 20:10:40,535 DEBUG - inotify - Adding watch for /home/fidel/Dropbox/Privat/Linux_Settings/Autokey-Textpattern/Text_Kommunikation 2015-12-16 20:10:40,536 DEBUG - inotify - Adding watch for /home/fidel/Dropbox/Privat/Linux_Settings/Autokey-Textpattern/Text_Linux_CMDs 2015-12-16 20:10:40,536 DEBUG - inotify - Adding watch for /home/fidel/Dropbox/Privat/Linux_Settings/Autokey-Textpattern/Scripts 2015-12-16 20:10:40,536 DEBUG - inotify - Adding watch for /home/fidel/Dropbox/Privat/Linux_Settings/Autokey-Textpattern/Text_www_urls 2015-12-16 20:10:40,537 DEBUG - inotify - Adding watch for /home/fidel/Dropbox/Privat/Linux_Settings/Autokey-Textpattern/HTML/Text_HTML 2015-12-16 20:10:40,537 INFO - config-manager - Successfully loaded configuration 2015-12-16 20:10:40,537 DEBUG - inotify - Adding watch for /home/fidel/.config/autokey/data 2015-12-16 20:10:40,538 DEBUG - inotify - Adding watch for /home/fidel/.config/autokey 2015-12-16 20:10:40,538 DEBUG - config-manager - Global settings: {'showTrayIcon': True, 'sortByUsageCount': True, 'scriptGlobals': {}, 'undoUsingBackspace': True, 'notificationIcon': u'autokey-status', 'enableQT4Workaround': False, 'promptToSave': True, 'menuTakesFocus': False, 'interfaceType': u'XRecord', 'windowDefaultSize': [1225, 817], 'showToolbar': True, 'serviceRunning': True, 'columnWidths': [150, 50, 100], 'workAroundApps': u'.VirtualBox.|krdc.Krdc', 'hPanePosition': 489, 'isFirstRun': False} 2015-12-16 20:10:40,538 INFO - service - Starting service 2015-12-16 20:10:40,585 DEBUG - interface - Enabling sending using Alt-Grid 2015-12-16 20:10:40,586 DEBUG - interface - Modifier masks: {'': 2, '': 8, '': 128, '': 16, '': 64, '': 4, '': 1, '': 8, '': 64} 2015-12-16 20:10:40,659 DEBUG - interface - Alt-Grid: XK_ISO_Level3_Shift, 65027 2015-12-16 20:10:40,659 DEBUG - interface - [(92, 0), (108, 0), (92, 2), (108, 2)] 2015-12-16 20:10:40,659 DEBUG - interface - X Server Keymap 2015-12-16 20:10:40,659 DEBUG - interface - [] : [(20, 4), (20, 7)] 2015-12-16 20:10:40,659 DEBUG - interface - [|] : [(94, 4), (94, 6)] ........ 2015-12-16 20:10:41,130 DEBUG - interface - Grabbing hotkey: [u'', u''] u'k' 2015-12-16 20:10:41,130 DEBUG - interface - Grabbing hotkey: [u'', u''] u'k' 2015-12-16 20:10:41,131 DEBUG - interface - Grabbing hotkey: [u''] u'' 2015-12-16 20:10:41,131 DEBUG - interface - Grabbing hotkey: [u''] u'' 2015-12-16 20:10:41,132 DEBUG - interface - Grabbing hotkey: [u''] u'' 2015-12-16 20:10:41,132 DEBUG - interface - Grabbing hotkey: [u''] u'' 2015-12-16 20:10:41,832 DEBUG - service - Received mouse click - resetting buffer 2015-12-16 20:10:43,166 DEBUG - iomediator - pressed 2015-12-16 20:10:43,733 DEBUG - service - Raw key: u',', modifiers: [''], Key: ; 2015-12-16 20:10:43,733 DEBUG - service - Window visible title: u'_Ungespeichertes Dokument 1 - gedit', Window class: 'gedit.Gedit' 2015-12-16 20:10:43,733 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:10:43,734 DEBUG - service - Input stack at end of handle_keypress: [u';'] 2015-12-16 20:10:43,863 DEBUG - iomediator - released 2015-12-16 20:10:45,423 DEBUG - service - Raw key: u'h', modifiers: [], Key: h 2015-12-16 20:10:45,423 DEBUG - service - Window visible title: u'_Ungespeichertes Dokument 1 - gedit', Window class: 'gedit.Gedit' 2015-12-16 20:10:45,423 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:10:45,424 DEBUG - service - Input stack at end of handle_keypress: [u';', u'h'] 2015-12-16 20:10:45,727 DEBUG - service - Raw key: u't', modifiers: [], Key: t 2015-12-16 20:10:45,727 DEBUG - service - Window visible title: u'_Ungespeichertes Dokument 1 - gedit', Window class: 'gedit.Gedit' 2015-12-16 20:10:45,727 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:10:45,728 DEBUG - service - Input stack at end of handle_keypress: [u';', u'h', u't'] 2015-12-16 20:10:45,865 DEBUG - service - Raw key: u'm', modifiers: [], Key: m 2015-12-16 20:10:45,865 DEBUG - service - Window visible title: u'_Ungespeichertes Dokument 1 - gedit', Window class: 'gedit.Gedit' 2015-12-16 20:10:45,865 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:10:45,866 DEBUG - service - Input stack at end of handle_keypress: [u';', u'h', u't', u'm'] 2015-12-16 20:10:46,216 DEBUG - service - Raw key: u'l', modifiers: [], Key: l 2015-12-16 20:10:46,216 DEBUG - service - Window visible title: u'_Ungespeichertes Dokument 1 - gedit', Window class: 'gedit.Gedit' 2015-12-16 20:10:46,216 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:10:46,217 DEBUG - service - Input stack at end of handle_keypress: [] 2015-12-16 20:10:46,217 DEBUG - service - Ignored locking error in handle_keypress Exception in thread Phrase-thread: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 813, in bootstrap_inner self.run() File "/usr/lib64/python2.7/threading.py", line 766, in run self.__target(_self.args, **self.__kwargs) File "/usr/lib/python2.7/site-packages/autokey/service.py", line 383, in execute self.macroManager.process_expansion(expansion) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 55, in process_expansion macro.process(parts) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 100, in process self.do_process(parts, i) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 129, in do_process args = self._get_args(parts[i]) File "/usr/lib/python2.7/site-packages/autokey/macro.py", line 93, in _get_args raise Exception("Missing mandatory argument '%s' for macro '%s'" % (k, self.ID)) Exception: Missing mandatory argument 'name' for macro 'script'

2015-12-16 20:10:49,673 DEBUG - service - Raw key: '', modifiers: [], Key: 2015-12-16 20:10:49,673 DEBUG - service - Window visible title: u'*Ungespeichertes Dokument 1 - gedit', Window class: 'gedit.Gedit' 2015-12-16 20:10:49,673 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:10:49,674 DEBUG - service - Input stack at end of handle_keypress: ['\n'] 2015-12-16 20:10:52,458 DEBUG - service - Received mouse click - resetting buffer 2015-12-16 20:10:57,044 DEBUG - service - Received mouse click - resetting buffer 2015-12-16 20:10:58,589 DEBUG - service - Received mouse click - resetting buffer 2015-12-16 20:11:00,291 DEBUG - service - Received mouse click - resetting buffer 2015-12-16 20:11:01,311 DEBUG - iomediator - pressed ^C2015-12-16 20:11:01,506 DEBUG - service - Raw key: u'c', modifiers: [''], Key: c 2015-12-16 20:11:01,506 DEBUG - service - Window visible title: u'/bin/bash', Window class: 'terminator.Terminator' 2015-12-16 20:11:01,506 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:11:01,608 DEBUG - iomediator - released 2015-12-16 20:11:03,486 DEBUG - service - Received mouse click - resetting buffer 2015-12-16 20:11:04,179 DEBUG - service - Raw key: '', modifiers: [], Key: 2015-12-16 20:11:04,179 DEBUG - service - Window visible title: u'/bin/bash', Window class: 'terminator.Terminator' 2015-12-16 20:11:04,179 DEBUG - service - No phrase/script matched hotkey 2015-12-16 20:11:04,180 DEBUG - service - Input stack at end of handle_keypress: ['\n'] Beendet

josephj11 commented 8 years ago

1) Although this may be a valid issue, it would be much easier to deal with on our mailing list (which I check several times a day). I get here infrequently. That's why I'm so long in replying to you.

It's much easier to try things out on the list and eliminate the obvious, before filing an issue with the benefit of whatever we've already learned on the list.

Also, many people read the list and can provide helpful input while, apparently, I am the only one reading and replying to issues.

2) Reading the trace, it appears that you typed the characters "html" into a gedit window.

AutoKey says no hotkeys were found, so it looks like you have a phrase or macro defined to trigger when AutoKey sees the user typed characters "html". The only way this should be able to happen is if the macro/phrase was set to Trigger immediately - with no separator characters (because AutoKey doesn't report seeing any before the problem occurs).

From what you say, I assume this was a trigger for a phrase, not a macro, but from the trace, it looks like AutoKey was trying to run a macro when it got upset. This is a paradox to be resolved.

If we had phrase definitions which triggered macros - especially (presumably) non-existent ones, there would have been many reports, so something else is probably going on.

3) Things to try, etc.:

a) Make sure you have one and only one thing (macro or phrase) set to trigger on the abbreviation "html". (This might only be OK if multiple definitions had different window filters defined, but I don't want to deal with that until more simple issues have been eliminated.)

b) Do your other phrases or macros work? How is this one different from them?

c) Turn off Trigger immediately for this phrase and see if it works when you type a space or press enter after "html". While you have it open, list all the setting for this phrase and post back here or attach a screen shot of the Abbreviations dialogue along with the rest of the settings displayed below it.

d) Look through all your macro and phrase definitions. For each one, look at the Abbreviations setting. If it says (None configured), go to the next one.

If there is an abbreviation defined, Click on the Set button to the right. This will open the Set Abbreviations dialog. There you will see a box on the left which lists all the abbreviations which trigger this phrase or macro. I need to know if any of these show a blank line before the first abbreviation or anywhere else except after all the abbreviations. I also want to know if you have any which do have more than one abbreviation defined.

e) Since I'm seeing some non-English (German?) in the trace, what locale and what character set are you using? We might want to try something like:

LC_CTYPE=C LC_ALL=C autokey-gtk -l

for a trace of the issue with your language settings turned off just for the test. This won't affect any other commands or the rest of your system if done this way.

yafp commented 8 years ago

I cant really explain where the issue was coming from - but it was most likely related with a messed up configuration.

@josephj11 Thanks for the feedback which helped solving it for me.