Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'module' object has no attribute 'Number'

Tags:

pillow

Not sure what is causing this...

I am running Python 3.4.3 using the "Pillow-3.3.0.win32-py34.exe" installation file.

Upon import Image with

from PIL import Image

I try to set "a.jpg" as my image using

img = Image.open("a.jpg")

However I get this error,

>>> img = Image.open("a.jpg")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 2289, in open
    preinit()
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 365, in preinit
    from PIL import JpegImagePlugin
  File "C:\Python34\lib\site-packages\PIL\JpegImagePlugin.py", line 40, in <modu
le>
    from PIL import Image, ImageFile, TiffImagePlugin, _binary
  File "C:\Python34\lib\site-packages\PIL\TiffImagePlugin.py", line 50, in <modu
le>
    from fractions import Fraction
  File "C:\Python34\lib\fractions.py", line 6, in <module>
    from decimal import Decimal
  File "C:\Python34\lib\decimal.py", line 3855, in <module>
    _numbers.Number.register(Decimal)
AttributeError: 'module' object has no attribute 'Number'

Might not be related to Pillow, but would still really appreciate help!

like image 330
Will Avatar asked Dec 01 '22 12:12

Will


1 Answers

Is there a file called numbers.py in the current working directory?

That could be the reason of the problem, because it'd prevent the import of the standard library module numbers.

(Suggestion from here.)

like image 101
Hugo Avatar answered May 03 '23 14:05

Hugo