Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting 'AttributeError' if script is using pywebview module. #5552

Closed
5 of 6 tasks
ParaSpl01t opened this issue Feb 12, 2021 · 1 comment
Closed
5 of 6 tasks

getting 'AttributeError' if script is using pywebview module. #5552

ParaSpl01t opened this issue Feb 12, 2021 · 1 comment

Comments

@ParaSpl01t
Copy link

ParaSpl01t commented Feb 12, 2021

Description of the issue

  • installed pywebview pip install pywebview
  • created a simple script test.py
import webview
print('anything')
  • ran pyinstaller --onedir --debug all --noupx test.py and got this output. The dist folder is empty.
91 INFO: PyInstaller: 5.0.dev0
91 INFO: Python: 3.9.1
94 INFO: Platform: Linux-5.10.15-zen1-1-zen-x86_64-with-glibc2.33
94 INFO: wrote /home/paradox/dev/projects/pnotes/test.spec
100 INFO: UPX is not available.
101 INFO: Extending PYTHONPATH with paths
['/home/paradox/dev/projects/pnotes', '/home/paradox/dev/projects/pnotes']
106 INFO: checking Analysis
106 INFO: Building Analysis because Analysis-00.toc is non existent
106 INFO: Initializing module dependency graph...
107 INFO: Caching module graph hooks...
111 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
113 INFO: Analyzing base_library.zip ...
2696 INFO: Processing pre-find module path hook distutils from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks/pre_find_module_path/hook-distutils.py'.
2696 INFO: distutils: retargeting to non-venv dir '/usr/lib/python3.9'
3332 INFO: Processing pre-safe import module hook gi.repository.Gtk from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Gtk.py'.
3332 INFO: Processing pre-safe import module hook gi.repository.Gdk from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.Gdk.py'.
3333 INFO: Processing pre-safe import module hook gi.repository.GLib from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-gi.repository.GLib.py'.
4378 INFO: Caching module dependency graph...
4481 INFO: running Analysis Analysis-00.toc
4519 INFO: Analyzing /home/paradox/dev/projects/pnotes/test.py
4521 INFO: Processing module hooks...
4522 INFO: Loading module hook 'hook-webview.py' from '/home/paradox/.local/lib/python3.9/site-packages/_pyinstaller_hooks_contrib/hooks/stdhooks'...
4522 INFO: Loading module hook 'hook-xml.py' from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks'...
4749 INFO: Loading module hook 'hook-sysconfig.py' from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks'...
4758 INFO: Loading module hook 'hook-gi.repository.Gdk.py' from '/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks'...
Traceback (most recent call last):
  File "/home/paradox/.local/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 725, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 672, in build
    exec(code, spec_namespace)
  File "/home/paradox/dev/projects/pnotes/test.spec", line 6, in <module>
    a = Analysis(['test.py'],
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 242, in __init__
    self.__postinit__()
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
    self.assemble()
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/building/build_main.py", line 420, in assemble
    self.graph.process_post_graph_hooks()
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/depend/analysis.py", line 367, in process_post_graph_hooks
    module_hook.post_graph()
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/depend/imphook.py", line 447, in post_graph
    self._load_hook_module()
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/depend/imphook.py", line 408, in _load_hook_module
    self._hook_module = importlib_load_source(
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/compat.py", line 598, in importlib_load_source
    return mod_loader.load_module()
  File "<frozen importlib._bootstrap_external>", line 469, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 969, in load_module
  File "<frozen importlib._bootstrap_external>", line 794, in load_module
  File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 711, in _load
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/hooks/hook-gi.repository.Gdk.py", line 16, in <module>
    binaries, datas, hiddenimports = get_gi_typelibs('Gdk', '3.0')
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/utils/hooks/gi.py", line 90, in get_gi_typelibs
    path = findSystemLibrary(lib.strip())
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/depend/bindepend.py", line 964, in findSystemLibrary
    return findLibrary(name)
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/depend/bindepend.py", line 780, in findLibrary
    utils.load_ldconfig_cache()
  File "/home/paradox/.local/lib/python3.9/site-packages/PyInstaller/depend/utils.py", line 402, in load_ldconfig_cache
    path = m.groups()[-1]
AttributeError: 'NoneType' object has no attribute 'groups'

Context information (for bug reports)

  • Output of pyinstaller --version: 5.0.dev0

  • Version of Python: e.g. 3.9.1

  • Platform: Arch Linux, Linux-5.10.15-zen1-1-zen-x86_64-with-glibc2.33

  • Did you also try this on another platform? Does it work there?
    Tried on arch on another desktop with freshly installed pip, pywebview, pyinstaller. No luck.

    • start with clean installation
    • use the latest development version
    • Run your frozen program from a command window (shell) — instead of double-clicking on it (no program)
    • Package your program in --onedir mode
    • Package without UPX, say: use the option --noupx or set upx=False in your .spec-file
    • Repackage you application in verbose/debug mode. For this, pass the option --debug to pyi-makespec or pyinstaller or use EXE(..., debug=1, ...) in your .spec file.

Same goes for import flask. Getting same error if I import anything except default modules.
EDIT: I remember updating my system before I started getting this error. I am sure this was working fine before update. Is there any more info I can provide?

@rokm
Copy link
Member

rokm commented Feb 12, 2021

Duplicate of #5540.

@rokm rokm closed this as completed Feb 12, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants