[FIX] P3: replace PyPDF by PyPDF2

PyPDF is unmaintained and abandoned (as noted on its home page
http://pybrary.net/pyPdf/) and was never updated to Python 3. PyPDF2 is
a fork which provides a mostly compatible API and is P3-compatible.

Replace PyPDF by PyPDF2.
This commit is contained in:
xmo-odoo
2017-05-12 13:28:57 +02:00
committed by GitHub
parent 13ee5596c6
commit 021de21e8c
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import pyPdf
import PyPDF2
import xml.dom.minidom
import zipfile
@@ -110,7 +110,7 @@ class IrAttachment(models.Model):
if bin_data.startswith('%PDF-'):
f = StringIO(bin_data)
try:
pdf = pyPdf.PdfFileReader(f)
pdf = PyPDF2.PdfFileReader(f, overwriteWarnings=False)
for page in pdf.pages:
buf += page.extractText()
except Exception:
+2 -2
View File
@@ -19,7 +19,7 @@ import re
from collections import namedtuple
from contextlib import closing
from pyPdf import PdfFileWriter, PdfFileReader
from PyPDF2 import PdfFileWriter, PdfFileReader
from distutils.version import LooseVersion
from reportlab.graphics.barcode import createBarcodeDrawing
@@ -84,7 +84,7 @@ def _merge_pdf(documents):
for document in documents:
pdfreport = open(document, 'rb')
streams.append(pdfreport)
reader = PdfFileReader(pdfreport)
reader = PdfFileReader(pdfreport, overwriteWarnings=False)
for page in range(0, reader.getNumPages()):
writer.addPage(reader.getPage(page))
+1 -1
View File
@@ -21,7 +21,7 @@ psycopg2==2.6.2
pydot==1.2.3
pyldap==2.4.28
pyparsing==2.1.10
pyPdf==1.13
PyPDF2==1.26.0
pyserial==3.1.1
python-dateutil==2.5.3
python-openid==2.2.5
+2 -2
View File
@@ -94,7 +94,7 @@ def py2exe_options():
'pychart',
'pydot',
'pyparsing',
'pyPdf',
'PyPDF2',
'pytz',
'reportlab',
'requests',
@@ -153,7 +153,7 @@ setup(
'pydot',
'pyldap', # optional
'pyparsing',
'pypdf',
'pypdf2',
'pyserial',
'python-dateutil',
'python-openid',