[Image-SIG] crash: Image.open("lena.ppm").show()

Fredrik Lundh fredrik@pythonware.com
Tue, 13 Jun 2000 13:22:08 +0200


Peter Schneider-Kamp wrote:
> I am using PIL 1.1 with the current CVS version under GNU/Linux.
>=20
> >>> Image.open("lena.ppm").show()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/local/lib/python1.6/site-packages/PIL/Image.py", line =
818,
> in show
>     _showxv(self, title, command)
>   File "/usr/local/lib/python1.6/site-packages/PIL/Image.py", line =
1151,
> in _showxv
>     file =3D self._dump(format=3Dformat)
>   File "/usr/local/lib/python1.6/site-packages/PIL/Image.py", line =
355,
> in _dump
>     file =3D file + "." + format
> TypeError: illegal argument type for built-in operation
>=20
> The reason seems to be that format =3D=3D None (passed somehow
> from _showxv. Note that the line numbers given vary from the
> original version because I used pindent to change the indentation.
>=20
> I fixed it for me by replacing the line with:
> file =3D file + "." + self.format
>=20
> Why does _showxv always pass format=3DNone for non "nt" OSes?

it's a known bug, and for some reason, the fix didn't make it
into the 1.1 release :-(

iirc, the "correct" way to fix this is to change:

    format =3D None

to

    format =3D "PPM"

in the _showxv function.

</F>