<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">The following code:<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; from PIL import Image<o:p></o:p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; im = Image.open(&quot;img.bmp&quot;)<o:p></o:p></p>
<p class="MsoNormal">&nbsp;&nbsp;&nbsp; im.show()<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">brings up the default Windows 7 Image Viewer. The image viewer does not display the image requested, but instead displays &#8220;windows photo viewer can't open this picture because either the picture is deleted, or it's in a location that isn't
 available&#8221;.<o:p></o:p></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">This site: <a href="http://www.velocityreviews.com/forums/t707158-python-pil-and-vista-windows-7-show-not-working.html">
http://www.velocityreviews.com/forums/t707158-python-pil-and-vista-windows-7-show-not-working.html</a> has an explanation for this behavior.<o:p></o:p></p>
<p class="MsoNormal"><span class="apple-style-span"><i><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#273D49;background:#EDEDED">What actually happens is that the Windows code relies on the fact that the default image viewer on Windows
 XP was able to work at blocking mode - this means that the command will wait until the image window will be closed. Because of that behaviour, they constructed a command line which deletes a file right after the image has been shown.</span></i></span><i><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#273D49"><br>
<br>
<span class="apple-style-span"><span style="background:#EDEDED">Windows Vista doesn't work the same way, it immediately returns once the command has been executed, so what happens now is that the temporary file gets immediately deleted by the command line,
 and the image viewer doesn't have enough time to load the image before it is being deleted.</span></span><br>
<br>
<span class="apple-style-span"><span style="background:#EDEDED">Here is a quick workaround:</span></span><br>
<br>
<span class="apple-style-span"><span style="background:#EDEDED">Edit C:\Python26\lib\site-packages\PIL\ImageShow.py, and around line 99, replace with the following line:</span></span><br>
<br>
<span class="apple-style-span"><span style="background:#EDEDED">return &quot;start /wait %s &amp;&amp; PING 127.0.0.1 -n 5 &gt; NUL &amp;&amp; del /f %s&quot; % (file, file)<o:p></o:p></span></span></span></i></p>
<p class="MsoNormal"><span class="apple-style-span"><i><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#273D49;background:#EDEDED"><o:p>&nbsp;</o:p></span></i></span></p>
<p class="MsoNormal"><span class="apple-style-span"><i><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#273D49;background:#EDEDED"><o:p>&nbsp;</o:p></span></i></span></p>
<p class="MsoNormal"><span class="apple-style-span"><i><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#273D49;background:#EDEDED"><o:p>&nbsp;</o:p></span></i></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;background:#EDEDED">I would like to report this behavior as a bug.<o:p></o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;background:#EDEDED"><o:p>&nbsp;</o:p></span></span></p>
<p class="MsoNormal"><span class="apple-style-span"><span style="font-size:9.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;background:#EDEDED">-Chris</span></span><o:p></o:p></p>
</div>
</body>
</html>