According to the docs of pyinstaller, if you name a file hook-fully.qualified.import.name.py
it will read this file whenever you do an import of the matching .py
file.
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've created hook-win32com.shell.py
with the following code:
hiddenimports = [
'win32com.shell.shell',
]
pyinstaller never reads this file, however it does read hook-win32com.py
so I've also tried with just adding `'win32com.shell' to the above hook file but that didn't do much.
win32com.shell
? (So i get rid of "No module named" in runtime of the .exe)This seems to be the case with: https://github.com/pyinstaller/pyinstaller/issues/1322
Apparently the new python3 graph is now used everywhere in pyinstaller, so this bug seems to apply for python2 users as well.
I suggest rewriting win32com.shell calls with ctypes.shell32, or cffi.