简体   繁体   English

pyinstaller没有读取我的钩子文件,并且不能与win32com.shell一起使用

[英]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'添加到上面的钩子文件中,但这并没有做太多。

  1. How do I get pyinstaller to read my hook file 如何让pyinstaller读取我的钩子文件
  2. How do I get it to include win32com.shell ? 如何让它包含win32com.shell (So i get rid of "No module named" in runtime of the .exe) (所以我在.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.

相关问题 ANACONDA navigator cannot launch-from win32com.shell import shellcon, shell - ANACONDA navigator cannot launch-from win32com.shell import shellcon, shell 编译白色pyinstaller时Python win32com注册类在excel vba中不起作用 - Python win32com registered class don't work in excel vba when compiled white pyinstaller pyinstaller和win32com - pyinstaller and win32com PyInstaller将我的python脚本构建为可执行文件,但是不起作用 - PyInstaller built my python scripts to executable file, but it doesn't work 使用 win32com.client.Dispatch() 读取 .doc 文件 - Reading .doc file using win32com.client.Dispatch() win32com:通过在后台打开Excel文件来使用它 - win32com: work with excel file by opening it in background 手动打开excel文件允许运行公式,使用VBScript或PowerShell打开excel文件或者Python的win32com不打开 - Opening an excel file manually allows formulas to run, opening an excel file with VBScript or PowerShell or Python's win32com doesn't win32clipboard.SetClipboardText()不起作用 - win32clipboard.SetClipboardText() doesn't work 我的exe 从 pyinstaller 创建的文件不像它是 .py 时那样工作(Pyexcel 问题) - My exe. file created from pyinstaller doesn't work like it does when it was .py (Pyexcel problem) Python win32api在Apache 2.2中不起作用 - Python win32api doesn't work in Apache 2.2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM