docker icon indicating copy to clipboard operation
docker copied to clipboard

[V18.0] PyPDF2 broken on arm64 build

Open PieterPaulussen opened this issue 1 year ago • 1 comments

Odoo V18 is broken when installing a module that uses the PyPDF2 library. Validated this against the V17 docker and it works for that version.

The following traceback appears:

web-1  | Traceback (most recent call last):
web-1  |   File "/app/enterprise/sign/models/sign_template.py", line 201, in _check_pdf_data_validity
web-1  |     self._get_pdf_number_of_pages(base64.b64decode(datas))
web-1  |   File "/app/enterprise/sign/models/sign_template.py", line 168, in _get_pdf_number_of_pages
web-1  |     file_pdf = PdfFileReader(io.BytesIO(pdf_data), strict=False, overwriteWarnings=False)
web-1  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |   File "/usr/local/lib/python3.12/site-packages/PyPDF2/_reader.py", line 1971, in __init__
web-1  |     super().__init__(*args, **kwargs)
web-1  | TypeError: PdfReader.__init__() got an unexpected keyword argument 'overwriteWarnings'
web-1  |
web-1  | During handling of the above exception, another exception occurred:
web-1  |
web-1  | Traceback (most recent call last):
web-1  |   File "/app/odoo/odoo/tools/convert.py", line 537, in _tag_root
web-1  |     f(rec)
web-1  |   File "/app/odoo/odoo/tools/convert.py", line 437, in _tag_record
web-1  |     record = model._load_records([data], self.mode == 'update')
web-1  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |   File "/app/odoo/odoo/models.py", line 5451, in _load_records
web-1  |     records = self._load_records_create([data['values'] for data in to_create])
web-1  |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
web-1  |   File "/app/odoo/odoo/models.py", line 5355, in _load_records_create
web-1  |     records = self.create(vals_list)
web-1  |               ^^^^^^^^^^^^^^^^^^^^^^
web-1  |   File "<decorator-gen-66>", line 2, in create
web-1  |   File "/app/odoo/odoo/api.py", line 480, in _model_create_multi
web-1  |     return create(self, arg)
web-1  |            ^^^^^^^^^^^^^^^^^
web-1  |   File "/app/enterprise/sign/models/sign_template.py", line 121, in create
web-1  |     self._check_pdf_data_validity(attachment.datas)
web-1  |   File "/app/enterprise/sign/models/sign_template.py", line 203, in _check_pdf_data_validity
web-1  |     raise UserError(_("One uploaded file cannot be read. Is it a valid PDF?"))
web-1  | odoo.exceptions.UserError: One uploaded file cannot be read. Is it a valid PDF?

PieterPaulussen avatar Nov 19 '24 11:11 PieterPaulussen

Hey @PieterPaulussen, you could try installing pypdf. PyPDF2 has gone back to its root with pypdf.

schwahue avatar Nov 21 '24 01:11 schwahue