Closed coffeejunk closed 1 month ago
pyinstaller fails when running on a 5.3.1 pywebview script:
requirements.txt:
pywebview==5.3.1 pyinstaller==6.11.0
hi.py:
import webview if __name__ == '__main__': webview.create_window( 'Hello', 'https://example.com' ) webview.start()
$ pyinstaller hi.py 126 INFO: PyInstaller: 6.11.0, contrib hooks: 2024.9 126 INFO: Python: 3.12.7 127 INFO: Platform: Linux-6.11.3-200.fc40.x86_64-x86_64-with-glibc2.39 127 INFO: Python environment: /usr 128 INFO: wrote /home/max/tmp/pyweb-install/hi.spec 129 INFO: Module search paths (PYTHONPATH): ['/usr/lib64/python312.zip', '/usr/lib64/python3.12', '/usr/lib64/python3.12/lib-dynload', '/home/max/.local/lib/python3.12/site-packages', '/usr/lib64/python3.12/site-packages', '/usr/lib/python3.12/site-packages', '/home/max/tmp/pyweb-install'] 425 INFO: checking Analysis 425 INFO: Building Analysis because Analysis-00.toc is non existent 426 INFO: Running Analysis Analysis-00.toc 426 INFO: Target bytecode optimization level: 0 426 INFO: Initializing module dependency graph... 426 INFO: Initializing module graph hook caches... 433 INFO: Analyzing base_library.zip ... 1385 INFO: Processing standard module hook 'hook-encodings.py' from '/home/max/.local/lib/python3.12/site-packages/PyInstaller/hooks' 2785 INFO: Processing standard module hook 'hook-pickle.py' from '/home/max/.local/lib/python3.12/site-packages/PyInstaller/hooks' 3668 INFO: Processing standard module hook 'hook-heapq.py' from '/home/max/.local/lib/python3.12/site-packages/PyInstaller/hooks' 3935 INFO: Caching module dependency graph... 4017 INFO: Looking for Python shared library... 4022 INFO: Using Python shared library: /lib64/libpython3.12.so.1.0 4022 INFO: Analyzing /home/max/tmp/pyweb-install/hi.py 4034 INFO: Processing standard module hook 'hook-webview.py' from '/home/max/.local/lib/python3.12/site-packages/webview/__pyinstaller' Traceback (most recent call last): File "/home/max/.local/bin/pyinstaller", line 8, in <module> sys.exit(_console_script_run()) ^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/__main__.py", line 231, in _console_script_run run() File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/__main__.py", line 215, in run run_build(pyi_config, spec_file, **vars(args)) File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/__main__.py", line 70, in run_build PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs) File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/building/build_main.py", line 1252, in main build(specfile, distpath, workpath, clean_build) File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/building/build_main.py", line 1192, in build exec(code, spec_namespace) File "/home/max/tmp/pyweb-install/hi.spec", line 4, in <module> a = Analysis( ^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/building/build_main.py", line 581, in __init__ self.__postinit__() File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/building/datastruct.py", line 184, in __postinit__ self.assemble() File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/building/build_main.py", line 721, in assemble program_scripts.append(self.graph.add_script(script)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/analysis.py", line 284, in add_script self._top_script_node = super().add_script(pathname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1177, in add_script self._process_imports(n) File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2608, in _process_imports target_modules = self._safe_import_hook(*import_info, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/analysis.py", line 455, in _safe_import_hook ret_modules = super()._safe_import_hook( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2065, in _safe_import_hook target_modules = self.import_hook( ^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1249, in import_hook target_package, target_module_partname = self._find_head_package( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1428, in _find_head_package target_package = self._safe_import_module( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/analysis.py", line 517, in _safe_import_module return super()._safe_import_module(module_basename, module_name, parent_package) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1809, in _safe_import_module self._process_imports(n) File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2608, in _process_imports target_modules = self._safe_import_hook(*import_info, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/analysis.py", line 386, in _safe_import_hook excluded_imports = self._find_all_excluded_imports(source_module.identifier) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/analysis.py", line 374, in _find_all_excluded_imports excluded_imports.update(module_hook.excludedimports) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/imphook.py", line 343, in __getattr__ self._load_hook_module() File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/depend/imphook.py", line 422, in _load_hook_module self._hook_module = importlib_load_source(self.hook_module_name, self.hook_filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/max/.local/lib/python3.12/site-packages/PyInstaller/compat.py", line 610, in importlib_load_source mod_loader.exec_module(mod) File "<frozen importlib._bootstrap_external>", line 995, in exec_module File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed File "/home/max/.local/lib/python3.12/site-packages/webview/__pyinstaller/hook-webview.py", line 8, in <module> datas += collect_data_files('webview', subdir='js') ^^^^^ NameError: name 'datas' is not defined
YES/NO I am willing to work on this issue myself.
YES/NO I am prepared to support this issue financially.
Fixed in 5.3.2
Specification
Description
pyinstaller fails when running on a 5.3.1 pywebview script:
requirements.txt:
hi.py:
Practicalities
YES/NO I am willing to work on this issue myself.
YES/NO I am prepared to support this issue financially.