[Image-SIG] Image.open problem
Fredrik Lundh
fredrik at pythonware.com
Mon Sep 8 16:49:27 CEST 2008
Janwillem van Dijk wrote:
> It all worked nicely but after a re-install of my systems (linux pc,
> linux laptop, windows pc) I have a problem with Image.open(fname). Under
> linux (python2.5 ubuntu 8.04) I get:
>
> Traceback (most recent call last):
> File "/media/DATAWINDOWS/Python/SobelQuality/open_image.py", line 6, in
> <module>
> image = Image.open(fname)
> File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 1902, in open
> return factory(fp, filename)
> File "/usr/lib/python2.5/site-packages/PIL/ImageFile.py", line 82, in
> __init__
> self._open()
> File "/usr/lib/python2.5/site-packages/PIL/JpegImagePlugin.py", line
> 270, in _open
> handler(self, i)
> File "/usr/lib/python2.5/site-packages/PIL/JpegImagePlugin.py", line
> 154, in DQT
> self.quantization[v&15] = array.array("b", s[1:65])
> AttributeError: 'module' object has no attribute 'array'
>
> with this simple test script:
> #open test image
> import sys, os.path, time
> from PIL import Image
> t = time.time()
> fname = os.path.join(sys.path[0],'lena.jpg')
> image = Image.open(fname)
> print 'Open %s width,height %d,%d took %.3f sec' % \
> (fname,image.size[0],image.size[1],time.time()-t)
PIL's JPEG module attempts to load the standard library module called
"array", but it looks as if "import array" fetches some other module.
check your Python paths for things named "array.py" or similar.
</F>
More information about the Image-SIG
mailing list