smileyninja / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

Autokey crashes when clipboard.get_clipboard() is invoked #226

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. text = clipboard.get_clipboard()
2. keyboard.send_keys(text)

What is the expected output? 
The clipboard's content.

What do you see instead?
Autokey crashes.

What version of the product are you using? On what operating system?
Autokey 0.90.4 on Ubuntu 12.10 Quantal Quetzal

Please provide any additional information below.

Original issue reported on code.google.com by dam...@gmail.com on 5 Nov 2012 at 6:56

GoogleCodeExporter commented 8 years ago
I was not able to reproduce this using either front-end with 0.90.4. Can you 
provide a log of the crash? Start autokey with the following:

autokey-gtk -l > ~/.autokey.log 2>&1 & disown

After the crash, provide the last 50 lines of the log file.

Original comment by Titan8...@gmail.com on 1 Mar 2013 at 5:13

GoogleCodeExporter commented 8 years ago
Unfortunately, I can't reproduce the crash either. Autokey seems to work
fairly well at the moment apart from the fact that it is unresponsive from
time to time: The sample script from above then pastes nothing as if the
clipboard was empty, which it isn't. I can't explain why the situation
improved, since I haven't changed my setup. (Still on autokey-gtk
0.90.1-1.1 in Quantal Quetzal.)

Original comment by dam...@gmail.com on 1 Mar 2013 at 11:04

GoogleCodeExporter commented 8 years ago
I can reproduce this. It happens on my VMWare Ubuntu 12.04 and VMWare 12.10 
installed via Software Center.

But, you can bypass the error by installing xclip (apt-get install xclip) 
instead:

yourText = subprocess.Popen(["xclip","-selection", "clipboard", 
"-o"],stdout=subprocess.PIPE).communicate()[0]
keyboard.send_keys(yourText)

Original comment by Sean.Win...@gmail.com on 4 Apr 2013 at 9:58

GoogleCodeExporter commented 8 years ago
I can reproduce, and get this in the log ('test' script invoked by pressing 
alt+v):

2013-04-11 19:09:26,671 DEBUG - service - Raw key: u'v', modifiers: ['<alt>'], 
Key: v
2013-04-11 19:09:26,671 DEBUG - service - Window visible title: u'*Unsaved 
Document 1 - gedit', Window class: 'gedit.Gedit'
2013-04-11 19:09:26,671 INFO - service - Matched hotkey phrase/script with 
prompt=False
2013-04-11 19:09:26,671 DEBUG - service - Script runner executing: 
Script('test')
2013-04-11 19:09:26,672 DEBUG - service - Ignored locking error in 
handle_keypress
2013-04-11 19:09:26,672 ERROR - service - Script error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 454, in execute
    exec script.code in scope
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/autokey/scripting.py", line 856, in get_clipboard
    self.__execAsync(self.clipBoard.request_text, self.__receive)
  File "/usr/lib/python2.7/dist-packages/autokey/scripting.py", line 865, in __execAsync
    callback(*args)
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 43, in function
    return info.invoke(*args, **kwargs)
TypeError: request_text() takes exactly 3 arguments (2 given)
Exception in thread Phrase-thread:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 464, in execute
    self.app.notify_error(_("The script '%s' encountered an error") % script.description)
  File "/usr/lib/python2.7/dist-packages/autokey/gtkapp.py", line 239, in notify_error
    self.notifier.notify_error(message)
  File "/usr/lib/python2.7/dist-packages/autokey/gtkui/notifier.py", line 145, in notify_error
    self.show_notify(message, Gtk.STOCK_DIALOG_ERROR)
  File "/usr/lib/python2.7/dist-packages/autokey/gtkui/notifier.py", line 156, in show_notify
    Gdk.threads_enter()
NameError: global name 'Gdk' is not defined

Debian testing, autokey-gtk 0.90.1-1.1

Original comment by to.bog...@gmail.com on 11 Apr 2013 at 5:18

GoogleCodeExporter commented 8 years ago
I get the same error. version: 0.90.1, Linux mint 14. My script is:

import time
time.sleep(0.25)
# The sleep seems to be necessary to avoid lockups
text = clipboard.get_selection()
#keyboard.send_key("<delete>")
#keyboard.send_keys("The text %s was here previously" % text)
winTitle = window.get_active_title()
winClass = window.get_active_class()
dialog.info_dialog("Window information", 
          "Active window information:\nTitle: '%s'\nClass: '%s' Text is: '%s'" % (winTitle, winClass, text))

Error log:

2013-07-13 11:37:20,210 DEBUG - service - Received mouse click - resetting 
buffer
2013-07-13 11:37:22,269 DEBUG - service - Received mouse click - resetting 
buffer
2013-07-13 11:37:24,591 DEBUG - service - Raw key: u'g', modifiers: [], Key: g
2013-07-13 11:37:24,591 DEBUG - service - Window visible title: u'Issue 226 - 
autokey - Autokey crashes when clipboard.get_clipboard() is invoked - Desktop 
automation utility for Linux and X... - Opera', Window class: 'opera.Opera'
2013-07-13 11:37:24,591 DEBUG - service - No phrase/script matched hotkey
2013-07-13 11:37:24,592 DEBUG - service - Input stack at end of 
handle_keypress: [u'g']
2013-07-13 11:37:24,727 DEBUG - service - Raw key: u'g', modifiers: [], Key: g
2013-07-13 11:37:24,728 DEBUG - service - Window visible title: u'Issue 226 - 
autokey - Autokey crashes when clipboard.get_clipboard() is invoked - Desktop 
automation utility for Linux and X... - Opera', Window class: 'opera.Opera'
2013-07-13 11:37:24,728 DEBUG - service - No phrase/script matched hotkey
2013-07-13 11:37:24,728 DEBUG - service - Input stack at end of 
handle_keypress: [u'g', u'g']
2013-07-13 11:37:24,968 DEBUG - service - Raw key: u'f', modifiers: [], Key: f
2013-07-13 11:37:24,968 DEBUG - service - Window visible title: u'Issue 226 - 
autokey - Autokey crashes when clipboard.get_clipboard() is invoked - Desktop 
automation utility for Linux and X... - Opera', Window class: 'opera.Opera'
2013-07-13 11:37:24,969 DEBUG - service - No phrase/script matched hotkey
2013-07-13 11:37:24,969 DEBUG - service - Script runner executing: 
Script('testWinAct')
2013-07-13 11:37:24,969 DEBUG - service - Input stack at end of 
handle_keypress: []
2013-07-13 11:37:24,970 DEBUG - service - Ignored locking error in 
handle_keypress
2013-07-13 11:37:25,220 ERROR - service - Script error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 454, in execute
    exec script.code in scope
  File "<string>", line 4, in <module>
  File "/usr/lib/python2.7/dist-packages/autokey/scripting.py", line 820, in get_selection
    self.__execAsync(self.selection.request_text, self.__receive)
  File "/usr/lib/python2.7/dist-packages/autokey/scripting.py", line 865, in __execAsync
    callback(*args)
  File "/usr/lib/python2.7/dist-packages/gi/types.py", line 47, in function
    return info.invoke(*args, **kwargs)
TypeError: request_text() takes exactly 3 arguments (2 given)
Exception in thread Phrase-thread:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/dist-packages/autokey/service.py", line 464, in execute
    self.app.notify_error(_("The script '%s' encountered an error") % script.description)
  File "/usr/lib/python2.7/dist-packages/autokey/gtkapp.py", line 239, in notify_error
    self.notifier.notify_error(message)
  File "/usr/lib/python2.7/dist-packages/autokey/gtkui/notifier.py", line 145, in notify_error
    self.show_notify(message, Gtk.STOCK_DIALOG_ERROR)
  File "/usr/lib/python2.7/dist-packages/autokey/gtkui/notifier.py", line 156, in show_notify
    Gdk.threads_enter()
NameError: global name 'Gdk' is not defined

Original comment by peto.k...@gmail.com on 13 Jul 2013 at 9:44