Open HackAck opened 11 years ago
version_info
refers to the version of Python you are running (hence sys.version_info
). Have you updated to PyPDF2? It seems that you are using the original pyPdf
; that name is no longer used. Additionally, your file object (file(fileName, "r")
) is not open in binary mode, which is likely the main cause of the problem (use "rb"
).
The version:
The error: return pyPdf.PdfFileReader(file(fileName, "r")).getNumPages() File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 374, in init self.read(stream) File "/usr/lib/pymodules/python2.7/pyPdf/pdf.py", line 778, in read newTrailer = readObject(stream, self) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 67, in readObject return DictionaryObject.readFromStream(stream, pdf) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 522, in readFromStream value = readObject(stream, pdf) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 58, in readObject return ArrayObject.readFromStream(stream, pdf) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 153, in readFromStream arr.append(readObject(stream, pdf)) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 69, in readObject return readHexStringFromStream(stream) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 273, in readHexStringFromStream return createStringObject(txt) File "/usr/lib/pymodules/python2.7/pyPdf/generic.py", line 239, in createStringObject retval = TextStringObject(string.decode("utf-16")) File "/usr/lib/python2.7/encodings/utf_16.py", line 16, in decode return codecs.utf_16_decode(input, errors, True) UnicodeDecodeError: 'utf16' codec can't decode bytes in position 4-5: illegal encoding