pyinstaller / pyinstaller

Freeze (package) Python programs into stand-alone executables
http://www.pyinstaller.org
Other
11.64k stars 1.93k forks source link

TypeError: UpdateResource() takes no keyword arguments #8038

Closed Duckyal closed 10 months ago

Duckyal commented 10 months ago

引用了python 3.10.9·pyinstaller 6.1.0·imagehash 4.3.1·pyperclip 1.8.2和pyautogui 0.9.54模块,但是报错,打包的程序也用不了

bwoodsend commented 10 months ago

At least provide a stacktrace please.

bwoodsend commented 10 months ago

Nevermind, presumably it's this line:

https://github.com/pyinstaller/pyinstaller/blob/d9c6a9ee8511609727d468d85205e0c5a8dd1760/PyInstaller/utils/win32/winresource.py#L151

Duckyal commented 10 months ago

那应该如何修改呢,我还想是不是python版本问题

Duckyal commented 10 months ago
  File "E:\python\抢课\抢课.spec", line 18, in <module>
    exe = EXE(
  File "C:\python\lib\site-packages\PyInstaller\building\api.py", line 628, in __init__
    self.__postinit__()
  File "C:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 184, in __postinit__
    self.assemble()
  File "C:\python\lib\site-packages\PyInstaller\building\api.py", line 752, in assemble
    self._retry_operation(winmanifest.write_manifest_to_executable, build_name, self.manifest)
  File "C:\python\lib\site-packages\PyInstaller\building\api.py", line 995, in _retry_operation
    return func(*args)
  File "C:\python\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 210, in write_manifest_to_executable
    winresource.add_or_update_resource(filename, manifest_xml, RT_MANIFEST, names, languages)
  File "C:\python\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 151, in add_or_update_resource
    win32api.UpdateResource(module_handle, res_type, res_name, data, language=res_lang)
TypeError: UpdateResource() takes no keyword arguments
rokm commented 10 months ago

What version of pywin32-ctypes do you have installed?

That keyword argument has been there since pywin32-ctypes 0.1.0, and PyInstaller >= 5.13 explicitly requires pywin32-ctypes >= 0.2.1.


Does it work if you edit C:\python\lib\site-packages\PyInstaller\utils\win32\winresource.py and change line 151 from

win32api.UpdateResource(module_handle, res_type, res_name, data, language=res_lang)

to

win32api.UpdateResource(module_handle, res_type, res_name, data, res_lang)
Duckyal commented 10 months ago

pywin32-ctypes的版本为0.2.2 改了之后,能够很好的完成打包,非常感谢

bwoodsend commented 10 months ago

What does C:\python\python -m pip freeze say?