[英]pyinstaller not reading my hook file and doesn't work with win32com.shell
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. 根据pyinstaller的文档,如果你命名一个文件
hook-fully.qualified.import.name.py
它会在你导入匹配的.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'
. 并且pyinstaller拒绝识别
win32com.shell
并出现以下错误: ImportError: No module named 'win32com.shell'
。 So I've created hook-win32com.shell.py
with the following code: 所以我用以下代码创建了
hook-win32com.shell.py
:
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. pyinstaller永远不会读取这个文件,但是它确实读取了
hook-win32com.py
所以我也尝试过将''win32com.shell'添加到上面的钩子文件中,但这并没有做太多。
win32com.shell
? 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 这似乎是这样的: 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. 显然,新的python3图现在在pyinstaller中随处可见,所以这个bug似乎也适用于python2用户。
I suggest rewriting win32com.shell calls with ctypes.shell32, or cffi. 我建议用ctypes.shell32或cffi重写win32com.shell调用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.