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
I encountered a weird issue in the new version 2.7.5 with 2.7.4 everything works fine.
Error details
Traceback (most recent call last):
File "/path/to/venv/bin/sil-run-test", line 33, in <module>
sys.exit(load_entry_point('sil-tests', 'console_scripts', 'sil-run-test')())
File "/path/to/sil-tests/sil_tests/main/cli.py", line 62, in main
print_results(ResultsList, args.pdf_output)
File "/path/to/sil-tests/sil_tests/pdf_results/pdf_results.py", line 159, in print_results
pdf.start_section("Test Results", 0)
File "/path/to/venv/lib/python3.9/site-packages/fpdf/fpdf.py", line 217, in wrapper
return fn(self, *args, **kwargs)
File "/path/to/venv/lib/python3.9/site-packages/fpdf/fpdf.py", line 4642, in start_section
with self.offset_rendering() as pdf:
File "/usr/lib64/python3.9/contextlib.py", line 119, in __enter__
return next(self.gen)
File "/path/to/venv/lib/python3.9/site-packages/fpdf/fpdf.py", line 4546, in offset_rendering
recorder = FPDFRecorder(self, accept_page_break=False)
File "/path/to/venv/lib/python3.9/site-packages/fpdf/recorder.py", line 30, in __init__
self._initial = deepcopy(self.pdf.__dict__)
File "/usr/lib64/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib64/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib64/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib64/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib64/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/lib64/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib64/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib64/python3.9/copy.py", line 210, in _deepcopy_tuple
y = [deepcopy(a, memo) for a in x]
File "/usr/lib64/python3.9/copy.py", line 210, in <listcomp>
y = [deepcopy(a, memo) for a in x]
File "/usr/lib64/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib64/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib64/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/lib64/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/usr/lib64/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib64/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib64/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/lib64/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/lib64/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/lib64/python3.9/copy.py", line 282, in _reconstruct
setattr(y, key, value)
File "<string>", line 4, in __setattr__
dataclasses.FrozenInstanceError: cannot assign to field 'glyph_id'
Minimal code
Here is some sample code which lead to this behaviour, note that you need to define the pdf.section_title_styles and import a font the way I did it in order to get the error. It is not a issue with this particular font, I tried others aswell but this did not effect the issue.
FROM fedora:34
RUN dnf install -y gcc make python python-pip python-virtualenv git glibc-devel findutils
Python version: 3.9.12
fpdf2 version used: 2.7.5
I have reviewed the release notes for version 2.7.5 but could not identify a specific change that might be related to this issue. Any guidance or resolution would be appreciated. My workaround for now is using the 2.7.4 version.
Thank you!
The text was updated successfully, but these errors were encountered:
Thanks for reporting the problem @Samu1808
This issue was introduced by #820 because I made Glyph a frozen dataclass. Consequently FPDFRecorder can not use deepcopy on it.
I will open a PR to fix this problem.
Describe the bug
I encountered a weird issue in the new version
2.7.5
with2.7.4
everything works fine.Error details
Minimal code
Here is some sample code which lead to this behaviour, note that you need to define the
pdf.section_title_styles
and import a font the way I did it in order to get the error. It is not a issue with this particular font, I tried others aswell but this did not effect the issue.Environment
Dockerfile
:fpdf2
version used: 2.7.5I have reviewed the release notes for version
2.7.5
but could not identify a specific change that might be related to this issue. Any guidance or resolution would be appreciated. My workaround for now is using the2.7.4
version.Thank you!
The text was updated successfully, but these errors were encountered: