[Image-SIG] show() bug in Image.py of PIL 1.1 (maybe)
Man-Yong Lee
manyong@gnu.org
Mon, 21 Aug 2000 06:32:11 +0900
Hi, Image-SIG guys
I'm new to this sig.
I think there is a bug in show()ing Image object via ``xv''
in case there's no support of Tkinter.
My environment is like this:
Red Hat Linux 6.2
Python 1.52
PIL 1.1
Around the line 975 of Image.py:
def _showxv(self, title=None, command=None):
if os.name == "nt":
format = "BMP"
if not command:
command = "start"
else:
format = None
if not command:
command = "xv"
if title:
command = command + " -name \"%s\"" % title
Following the codes above, the value of format is always None
when os.name is not "nt"
base = getmodebase(self.mode)
if base != self.mode and self.mode != "1":
file = self.convert(base)._dump(format=format)
else:
file = self._dump(format=format)
So, self._dump(format=format) will be called as
self._dump(format=None).
This makes these codes raise TypeError exception! (around the
line 312)
def _dump(self, file=None, format="PPM"):
import tempfile
if not file:
file = tempfile.mktemp()
self.load()
if format == "PPM":
self.im.save_ppm(file)
else:
file = file + "." + format
^^^^^^^^^^^^^^^^^^^^^^^^^^
self.save(file, format)
return file
Because format is always None, ``file = file + "." + format''
raise TypeError exception. (string type + None!)
My dirty hack is like this:
Before calling file = self._dump(format=format), I inserts
these lines.
if not format: # FIXME
format = self.format
if not format:
format = 'PPM'
file = self._dump(format=format)
Thanks for reading this.
Am I wrong? I want your comment.
__
Bryan Lee Linux Korea, Inc.