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

Debug raising error when running as packaged app by pyinstaller #575

Closed
wants to merge 1 commit into from

Conversation

zlt999
Copy link

@zlt999 zlt999 commented Oct 31, 2024

I run the packaged app by pyinstaller on windows platform, and get error raised as below:

Traceback (most recent call last):
  File "<frozen __main__>", line 3, in <module>
  File "<frozen src.main>", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "main_window.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "bincopy.py", line 18, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 378, in exec_module
  File "elftools\elf\elffile.py", line 17, in <module>
AttributeError: module 'resource' has no attribute 'getpagesize'
[PYI-26572:ERROR] Failed to execute script 'main' due to unhandled exception!

Still not sure where this resouce.py come from. I use dir() and get output as below:

['__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

This resource.py seems to be empty.

After all, I changed the source code in elffile.py and the problem is gone.

@sevaa
Copy link
Contributor

sevaa commented Oct 31, 2024

IIRC, resource is a built-in library in CPython.

@sevaa
Copy link
Contributor

sevaa commented Nov 12, 2024

@eliben This looks inoffensive enough. PAGESIZE, strictly speaking, is not even particularly necessary - it's only used for reading chunks to be decompressed, a hard coded buffer size would do just as well.

@eliben
Copy link
Owner

eliben commented Nov 12, 2024

@sevaa agreed, would you like to send a quick PR to remove all that PAGESIZE mess? I suppose something like a 4 KiB buffer size would do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants