Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"import decimal" raises errors

here's the code I am using

import os
import decimal
from pyPdf import PdfFileReader
path = r"E:\python\Real Python\Real Python\Course materials\Chapter 8\Practice files"
inputFileName = os.path.join(path,"Pride and Prejudice.pdf")
inputFile = PdfFileReader(file(inputFileName,"rb"))

print "Number of pages:", inputFile.getNumPages()
print "Title:", inputFile.getDocumentInfo().title

Now, when I run this code I am getting an error: module 'object' has no attribute 'Number'

I took a screenshot of the whole output that I got when I run the above code, with errors and everything. so,please take a look and let me know what's wrong?

enter image description here

like image 601
faraz Avatar asked Dec 16 '22 13:12

faraz


1 Answers

That's a printout of all numbers up to 50 that aren't divisible by 3. It's probably in a numbers module on sys.path that's shadowing the standard library numbers. See where it is:

import numbers
print numbers.__file__
like image 187
Eryk Sun Avatar answered Dec 18 '22 10:12

Eryk Sun