5

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

faraz
  • 2,603
  • 12
  • 39
  • 61
  • 1
    As I've said before,(it seems) your decimal module is broken.. – pradyunsg Mar 12 '13 at 06:59
  • well, so what should I do to solve this? is there a way to have a new decimal module? – faraz Mar 12 '13 at 07:07
  • I don't know... Try this : `import numbers; print numbers.Number` if you get an `AttributeError: 'module' object has no attribute 'Number'`, then the problem is the numbers module.. – pradyunsg Mar 12 '13 at 07:15

1 Answers1

13

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__
Eryk Sun
  • 33,190
  • 5
  • 92
  • 111
  • 2
    Wow! this worked. there was a numbers file that I had created earlier for solving an exercise and it seems that this file was being called instead of the numbers module. I changed the name of the numbers file and now, it's working properly. Thank you so much. – faraz Mar 12 '13 at 07:14