Pyinstaller does not read my hooks file and fails with win32com.shell
According to the pyinstaller docs, if you name a file hook-fully.qualified.import.name.py
, it will read that file whenever you import the corresponding file .py
.
However, my script looks like this:
import pythoncom
from win32com.shell import shell
from win32com import storagecon
...
And pyinstaller refuses to recognize win32com.shell
with the following error: ImportError: No module named 'win32com.shell'
. So I created hook-win32com.shell.py
with the following code:
hiddenimports = [ 'win32com.shell.shell', ]
pyinstaller never reads this file, however it does hook-win32com.py
, so I also tried to just add `` win32com.shell '' to the above file with hooks, but it didn't do much.
- How do I get pyinstaller to read my hook file.
- How do I enable
win32com.shell
? (So I get rid of "No module named" at runtime .exe)
source to share
It looks like this: https://github.com/pyinstaller/pyinstaller/issues/1322
Apparently the new python3 graph is now used everywhere in pyinstaller, so this bug seems to apply to python2 users as well.
I suggest rewriting calls to win32com.shell with ctypes.shell32 or cffi.
source to share