问题
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.
回答1:
It looks like you've assigned an open file to the name file
, and then you can't use the builtin any more.
来源:https://stackoverflow.com/questions/7045606/pypdfs-pdffilereader-having-problems-reading-file-file-not-callable