OCA / edi

GNU Affero General Public License v3.0
118 stars 300 forks source link

PyPDF2 usage problem in pdf_helper 16.0 #842

Open risto42 opened 9 months ago

risto42 commented 9 months ago

Module

pdf_helper in 16.0

Describe the bug

Attempting to activate some edi modules from OCA where an error traceback indicates that pdf_helper is trying to import PdfReadError from PyPDF2.utils

It does appear that PdfReadError is in PyPDF3.utils, but in PyPDF2 (which is currently used), it is found in .errors.

Additional context Here's a patch that worked for me:

diff --git a/pdf_helper/models/helper.py b/pdf_helper/models/helper.py
index 52b30355..8dbe8545 100644
--- a/pdf_helper/models/helper.py
+++ b/pdf_helper/models/helper.py
@@ -3,7 +3,7 @@
 # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
 import logging

-from PyPDF2.utils import PdfReadError
+from PyPDF2.errors import PdfReadError

 from odoo import models
github-actions[bot] commented 3 months ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

risto42 commented 3 months ago

This seems to have been fixed by

commit 0329fc52cb36ff963e705ce1db00e1ef6ea6872c
Author: Jacques-Etienne Baudoux <je@bcim.be>
Date:   Fri Dec 22 15:57:52 2023 +0100

    [FIX] pdf_helper: multi-attachments

    Replace code by odoo.tools.pdf