PyPDF's PdfFileReader() having problems reading file, file not callable
So here is my import:
from pyPdf import PdfFileWriter, PdfFileReader
Here is were I write my pdf:
filenamer = filename + '.pdf'
pdf = PdfPages(filenamer)
(great naming convention, I know!)
I write some things to it.
I close it here:
pdf.close()
Here is where I try and read it:
input1 = PdfFileReader(file(filenamer, "rb"))
And here is the error:
Traceback (most recent call last):
File "./datamine.py", line 405, in <module>
input1 = PdfFileReader(file(filenamer, "rb"))
TypeError: 'file' object is not callable
开发者_如何学编程
I dont understand the error, because I know the file exists, and when I comment out this line, and subsequent lines to input1, the program runs fine.
It looks like you've assigned an open file to the name file
, and then you can't use the builtin any more.
精彩评论