I'm not sure if this is the best place to post this, but I've noticed a large request for pyHook for Python 2.6. I had a solution to this in a recent thread here, but people are most likely going to miss that.

I built pyHook's source for use with Python 2.6, but keep in mind that this is sort of hacked together. Please take care when using it, because as far as I know it works fine, but there may be deeper-down issues that I hadn't spotted.

I've attached the compiled source that you need to manually install into your Python 2.6's site-packages folder. Navigate to it (C:\Python26\Lib\site-packages) and copy the pyHook folder into it. Then create a file in the site-packages folder named "pyHook.pth" and in it, type "pyHook". That's all. Now you should be able to pop-up IDLE and type "import pyHook" without any errors.

Also, you'll need the win32 extensions by Mark Hammond for this to work, which you can download from SourceForge here.

Please tell me if you encounter any issues with this pyHook build!
Enjoy :)

pyHook is licensed under the MIT License.

7 Years
Discussion Span
Last Post by bujisky

I have an issue to report:

When using your pyhook version on python 2.6 together with wx (both running in seperate threads, pyhook samples global keyboard events) the wx app will freeze the moment you try to type something into an input field.

This bug can be removed by removing pythoncom.PumpMessages() from the thread running the pyhook - but then the hotkey seizes to work (which else is working nicely).

Same code is running fine under python 2.5 with original pyhook.

I think best solution for me now is to fork the pyhook thread out (which will be a bit tricky under windows) to get my app running in a way that users can enter text...



thanks for letting us know

Let's hope the file _cpyHook.pyd was compiled with the proper MS C version to match the Python2.6 exe file.


Yeah, that's definitely a problem. I hope the developers for pyHook release a 2.6 version soon... in the meantime, you can just download the 2.5 source and try re-compiling it yourself for 2.6. You'll probably do a better job than me as, like Bumsfeld said, I probably screwed it up :P It doesn't take very long to remake it yourself, and it may solve the issue that my version has :S

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.