Python PIL and Vista/Windows 7 .. show() not working ...
Esmail
ebonak at gmail.com
Mon Nov 30 17:48:45 EST 2009
On Nov 30, 4:37 pm, David Bolen <db3l.... at gmail.com> wrote:
> Esmail <ebo... at gmail.com> writes:
> > I dug around in the docs and found a named parameter that I can set
> > when I
> > call show.
>
> > Definition: im.show(self, title=None, command=None)
>
> > I installed irfanview and specified it/its path in the parameter,
> > but that didn't work either. It's really quite puzzling in the
> > case of Vista since that's been around for quite a few years now.
>
> But I thought everyone was sticking their fingers in their ears and
> humming to try to forget Vista had been released, particularly now
> that Windows 7 is out :-)
>
> Perhaps there's an issue with the temporary file location. I don't
> have a Vista system to test on, but the show() operation writes the
> image to a temporary file as returned by tempfile.mktemp(), and then
> passes the name on to the external viewer. The viewing command is
> handed to os.system() with the filename embedded without any special
> quoting. So if, for example, the temporary location has spaces or
> "interesting" characters, it probably won't get parsed properly.
>
> One easy debugging step is probably to add a print just before the
> os.system() call that views the image (bottom of _showxv function in
> Image.py in my copy of 1.1.6). That way at least you'll know the
> exact command being used.
>
> If that's the issue, there are various ways around it. You could
> patch PIL itself (same function) to quote the filename when it is
> constructing the command. Alternatively, the tempfile module has a
> tempdir global you could set to some other temporary directory before
> using the show() function (or any other code using tempfile).
>
> -- David
Thanks for the pointers David, this will give me some things to
investigate.
As for me, I'm a long time and regular Linux user with some XP tossed
in.
I use the PIL under XP at times, but this problem is happening to
someone
I know who is using both Vista and Windows and can't get the basic
thing
to work so I am trying to help. (I have access to a Win 7 VM for
testing
purposes at least).
If I find a work-around or fix or concrete cause I'll post. In the
meantime
if anyone has any other ideas or fixes/suggestions, please don't be
shy :-)
Thanks,
Esmail
More information about the Python-list
mailing list