[Image-SIG] im.show() using eog doesn't work second time

Fredrik Lundh fredrik at pythonware.com
Wed Jun 3 00:40:59 CEST 2009


On Wed, Jun 3, 2009 at 12:28 AM, Dan Halbert <halbert at halwitz.org> wrote:
> I'm using PIL 1.1.6 on Ubuntu jaunty, and noticed a problem with invoking im.show() more than once without closing the image viewing window. On this system, im.show() uses "eog" to view the images. If you do something like:
>
>>>>im.show()  # don't close the eog window
>>>>im.show()
>
> then the second im.show() causes an error. The actual images don't matter: they could be the same or different.
>
> The two im.show() calls invoke Image._showxv() twice, which effectively does this:
>
>   os.system("(eog /tmp/tmp123; rm -f /tmp/tmp123)&")
>   os.system("(eog /tmp/tmp456; rm -f /tmp/tmp456)&")
>
> However, eog is very clever and tries to reuse its first instance. So the second instantiation of eog exits immediately after notifying the first to display /tmp/tmp456. But then the file disappears out from under it.
>
> The _showxv() code shows a similar problem already came up on OS X, and a "sleep 20" was inserted before the "rm". For eog, another, perhaps more elegant solution is to invoke eog as "eog -n", which always starts a new instance instead of reusing an existing one.

The standard 1.1.6 distribution doesn't know about eog, so this is
probably an Ubuntu-specific fix.  Have you reported the problem to
Ubuntu?

</F>


More information about the Image-SIG mailing list