On Mon, Nov 30, 2009 at 12:57 PM, Esmail <ebo...@hotmail.com> wrote: > Hello all. > > I am using the PIL 1.1.6 and Python 2.6.x under XP without any > problems. However, I can't display any images under Vista > or Windows 7. I could understand Windows 7 as it's relatively > new, but Vista has been around for a bit. > > Sample code: > > import Image > > im = Image.open('c://mypic.jpg') > im.show() > > > this will work fine under XP, but under Windows 7 and Vista > the default image viewer will come up with some error message > that the image can't be found. > > I tried with an external image view program and tried to supply > it via the command parameter to show - but that too didn't work. > > Definition: im.show(self, title=None, command=None) > > Any suggestions/help/workarounds? If you can get this to work > with Vista or Windows 7 I'd love to hear from you. > > Thanks! > Esmail > > -- > http://mail.python.org/mailman/listinfo/python-list >
show() executes a command like: os.system("start /wait TempFile.BMP && del /f TempFile.BMP") On Vista, HELP START displays the following: ... If Command Extensions are enabled, external command invocation through the command line or the START command changes as follows: ... When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. This new behavior does NOT occur if executing within a command script. ... The "/wait" apparently does nothing and the image file is deleted before the image viewer gets a chance to open it. (I think) [I don't understand why it works in XP since "HELP START" says basically the same thing] I haven't tried to fix it yet but a likely solution is to split up the command. os.system("start TempFile.BMP") wait a second os.system(del /f TempFile.BMP") -- http://mail.python.org/mailman/listinfo/python-list