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

Try fixing a bug encountered when using weasyprint in Pyinstaller context #1089

Merged
merged 1 commit into from
Mar 27, 2020

Conversation

bartbroere
Copy link
Contributor

When packaging weasyprint as a dependency in a Pyinstaller project, it looks for the VERSION file in the root sys._MEIPASS when the actual file ends up in sys._MEIPASS's subdirectory weasyprint. This pull request fixes that.

Maybe there's a reason the code is currently implemented this way. In that case I wouldn't mind to look for a solution to support all use cases.

Sample stack trace of the problem on runtime of an executable created with PyInstaller:

Traceback (most recent call last):
  File "site-packages\(...)\__init__.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\Python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
  File "site-packages\weasyprint\__init__.py", line 41, in <module>
  File "pathlib.py", line 1174, in read_text
  File "pathlib.py", line 1161, in open
  File "pathlib.py", line 1015, in _opener
  File "pathlib.py", line 387, in wrapped
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\bart\\AppData\\Local\\Temp\\_MEI826202\\VERSION'

@liZe
Copy link
Member

liZe commented Mar 27, 2020

Thank you!

Maybe there's a reason the code is currently implemented this way. In that case I wouldn't mind to look for a solution to support all use cases.

git blame gives the commit where the feature had been added, so… If it works for you, I suppose that it works everywhere 😄.

@liZe liZe merged commit 880e9e2 into Kozea:master Mar 27, 2020
@grewn0uille grewn0uille added this to the 52 milestone Oct 29, 2020
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