Russel
2012-04-28 06:41:14 UTC
OS. Windows7-64bit Ultimate
Python 2.3 & 2.6 & 2.7-64bit
Quick overview of SendKeys in Python:
SendKeys source: http://pastebin.com/hYDzdVtM
If you know how the module works, then you know that you can simulate a keystroke with one line as follows after importing SendKeys.
SendKeys.SendKeys('a')
That would simulate a single keypress of the key a. To simulate something like Ctrl + a:
SendKeys.SendKeys('^a')
Where the ^ character represents the Ctrl key.
Overview of the problem:
Every combination of keys that I've used so far works fine.
But... when I try Ctrl + c, something must go wrong. These are the two errors I get.
Error #1
Traceback (most recent call last):
..File "
....SendKeys.SendKeys('^c')
..File "C:\Python26\lib\site-packages\SendKeys.py", line 358, in SendKeys
....playkeys(_keys, pause)
..File "C:\Python26\lib\site-packages\SendKeys.py", line 311, in playkeys
....time.sleep(pause)
KeyboardInterrupt
Error #2:
Traceback (most recent call last):
..File "
....SendKeys.SendKeys('^c')
..File "C:\Python26\lib\site-packages\SendKeys.py", line 358, in SendKeys
....playkeys(_keys, pause)
..File "C:\Python26\lib\site-packages\SendKeys.py", line 311, in playkeys
....time.sleep(pause)
TypeError: 'int' object is not callable
Observations:
After the program stops and traceback prints the Ctrl key is permanently pressed(activated) unless I tap it to get it to get it to release.
All the searching I've done so far suggests that this is a problem not just with python SendKeys but various other modules in various languages. At this point it would make sense to just look to another way of copying, such as cutting instead of copying which works, but it would be really nice to know just what is the cause of this. Thanks for any help.
I'm a programming student so still learning.