You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is working fine with v58.1 but Im having issue with v59.0.
Below is a snippet of the trace log:
File "/Users/keong/.pyenv/versions/hcp/lib/python3.10/site-packages/weasyprint/images.py", line 106, in draw
image_name = stream.add_image(self, width, height, interpolate, ratio)
File "/Users/keong/.pyenv/versions/hcp/lib/python3.10/site-packages/weasyprint/pdf/stream.py", line 383, in add_image
xobject = image.get_xobject(width, height, interpolate)
File "/Users/keong/.pyenv/versions/hcp/lib/python3.10/site-packages/weasyprint/images.py", line 160, in get_xobject
pillow_image = Image.open(io.BytesIO(self.image_data.data))
File "/Users/keong/.pyenv/versions/hcp/lib/python3.10/site-packages/weasyprint/images.py", line 235, in data
return Path(self._filename).read_bytes()
File "/Users/keong/.pyenv/versions/3.10.7/lib/python3.10/pathlib.py", line 1126, in read_bytes
with self.open(mode='rb') as f:
File "/Users/keong/.pyenv/versions/3.10.7/lib/python3.10/pathlib.py", line 1119, in open
return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/media/logos/abcd.png'
After some debugging, I found out the code that is responsible for caching the files is using relative path instead of absolute path.
I managed to get it work locally by adding an extra line right above L315
which combines the absolute path of my Django project with the relative file path. filename = absolute_path_to_the_project + filename
The text was updated successfully, but these errors were encountered:
Im working with Django 4.0 and using the url_fetcher parameter when building the HTML as follows:
It is working fine with v58.1 but Im having issue with v59.0.
Below is a snippet of the trace log:
After some debugging, I found out the code that is responsible for caching the files is using relative path instead of absolute path.
I managed to get it work locally by adding an extra line right above L315
which combines the absolute path of my Django project with the relative file path.
filename = absolute_path_to_the_project + filename
The text was updated successfully, but these errors were encountered: