Python pyinstaller未读取我的挂钩文件,并且不';不能使用win32com.shell

Python pyinstaller未读取我的挂钩文件,并且不';不能使用win32com.shell,python,windows,python-3.x,pywin32,Python,Windows,Python 3.x,Pywin32,根据pyinstaller的文档,如果您命名一个文件hook fully.qualified.import.name.py,则每当您导入匹配的.py文件时,它都会读取该文件 但是,我的脚本如下所示: import pythoncom from win32com.shell import shell from win32com import storagecon ... pyinstaller拒绝识别win32com.shell,错误如下:ImportError:没有名为“win32com.sh

根据pyinstaller的文档,如果您命名一个文件
hook fully.qualified.import.name.py
,则每当您导入匹配的
.py
文件时,它都会读取该文件

但是,我的脚本如下所示:

import pythoncom
from win32com.shell import shell
from win32com import storagecon
...
pyinstaller拒绝识别
win32com.shell
,错误如下:
ImportError:没有名为“win32com.shell”的模块
。 因此,我使用以下代码创建了
hook-win32com.shell.py

hiddenimports = [
    'win32com.shell.shell',
]
pyinstaller从不读取此文件,但是它读取的是
hook-win32com.py
,因此我也尝试过向上面的hook文件中添加“win32com.shell”,但效果不太好

  • 如何让pyinstaller读取我的钩子文件
  • 如何让它包含
    win32com.shell
    ?(所以我在.exe的运行时去掉了“无模块名”)

  • 以下情况似乎就是如此:

    显然,新的python3图形现在在pyinstaller中随处可见,所以这个bug似乎也适用于python2用户


    我建议用ctypes.shell32或cffi重写win32com.shell调用。

    我在github上写了这个问题,但你会得到很好的分数:)确实是的,(现在我已经检查过了!)-当我遇到完全相同的问题时,它很有用!在我的例子中,我在shell中只使用了两个函数,所以重写这些调用对我来说很容易。谢谢