0

I was compiling some python script using pyhook and pythoncom. The build was successfully after notifying that there is missing module named _cpyHook from pyHook.cpyHook. When i start the .exe file it returns this import error.

Traceback (most recent call last):
    File "C:\Python34\Lib\site-packages\pyHook\cpyHook.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_cpyHook', [dirname(__file__)])
    File "C:\Python34\Lib\imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
    ImportError: No module named '_cpyHook'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
    File "app.py", line 17, in <module>
    File "E:\projects\pykalappai\EkEngine\Engine.py", line 3, in <module>
    import pyHook
    File "C:\Python34\Lib\site-packages\pyHook\__init__.py", line 1, in <module>
    from .HookManager import *
    File "C:\Python34\Lib\site-packages\pyHook\HookManager.py", line 1, in <module>
    from . import cpyHook
    File "C:\Python34\Lib\site-packages\pyHook\cpyHook.py", line 28, in <module>
    _cpyHook = swig_import_helper()
    File "C:\Python34\Lib\site-packages\pyHook\cpyHook.py", line 20, in swig_import_helper
    import _cpyHook
    ImportError: No module named '_cpyHook'

I have googled this and tried these solutions like

  1. renaming the pyHook._cpyHook.pyd to _cpyHook.pyd
  2. Copy pasted the _cpyHook.pyd and cpyHook.py from site-packages\pyHook to site-packages.

None of this worked for me.

Mohan Rex
  • 1,674
  • 2
  • 17
  • 22

1 Answers1

0

I had the same problem.

Before you compile it, copy the _cpyHook.pyd and cpyHook.py files from "c:\PythonXX\Lib\site-packages\pyHook" to "c:\PythonXX\Lib\site-packages", then compile it and it should work.

andyADD
  • 610
  • 1
  • 6
  • 20