TypeError: int() got an unexpected keyword argument 'base' error of pyPdf-1.15 in ironpython

StackOverflow https://stackoverflow.com/questions/22452307

  •  15-06-2023
  •  | 
  •  

Question

I have installed pyPDF2 pyPdf-1.15 successfully installed when I open terminal and type these codes

import os
from PyPDF2 import PdfFileReader
path = "F:/Download"
inputFileName = os.path.join(path, "RealPython.pdf")
inputFile = PdfFileReader(open(inputFileName, "rb"))

Then this comes

Traceback (most recent call last):
  File "<string>", line 1, in <module>

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\pdf.py", line 797, in __init__
    self.read(stream)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\pdf.py", line 1352, in read
    xrefstream = readObject(stream, self)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py", line 71, in readObject
    return DictionaryObject.readFromStream(stream, pdf)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py", line 587, in readFromStream
    value = readObject(stream, pdf)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py", line 62, in readObject
    return ArrayObject.readFromStream(stream, pdf)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py", line 158, in readFromStream
    arr.append(readObject(stream, pdf))

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py", line 73, in readObject
    return readHexStringFromStream(stream)

  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py", line 302, in readHexStringFromStream
    txt += chr(int(x, base=16))


TypeError: int() got an unexpected keyword argument 'base'

I don't know what I'm doing wrong, any help?

Was it helpful?

Solution

Error: int() got an unexpected keyword argument 'base'. Most likely this is related to ironpython int function implementation. You can try to edit this file in PyPDF2 package: C:\Program Files (x86)\IronPython 2.7\lib\site-packages\PyPDF2\generic.py (line 302, in readHexStringFromStream). Pass 16 as second positional argument to int:

#txt += chr(int(x, base=16))
txt += chr(int(x, 16))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top