[Image-SIG] PIL throws exception when reading 8bit greyscale bitmap and pnm data

Fredrik Lundh fredrik at pythonware.com
Sat Dec 2 13:03:12 CET 2006


Cameron Walsh wrote:

> But does not work for .pnm images in the same folder:
> 
> cameron at cameron-laptop:~$ convert test.bmp test.pnm
> cameron at cameron-laptop:~$ python
> import Image
> img=Image.open("test.pnm")
> data=img.getdata()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/local/lib/python2.5/site-packages/PIL/Image.py", line 796,
> in getdata
>     self.load()
>   File "/usr/local/lib/python2.5/site-packages/PIL/ImageFile.py", line
> 147, in load
>     self.map = mmap.mmap(file.fileno(), size)
> EnvironmentError: [Errno 19] No such device

can you try changing the except clause around line 153 from

                 except (AttributeError, IOError, ImportError):

to

                 except (AttributeError, EnvironmentError, ImportError):

and see if it solves the problem.

</F>



More information about the Image-SIG mailing list