I&#39;m not sure if it&#39;s been noted before, but there&#39;s an incompatility in PIL with the FlashPix file IO and python 2.4 and up. &nbsp;Trying to load such a file can give OverflowError; see patch below.<br><br><br><br>In&nbsp;the&nbsp;file&nbsp;
OleFileIO.py,&nbsp;the&nbsp;function&nbsp;i32()&nbsp;uses&nbsp;&lt;&lt;.&nbsp;&nbsp;Several&nbsp;parts&nbsp;of&nbsp;this&nbsp;file&nbsp;then&nbsp;rely&nbsp;on&nbsp;<br>the&nbsp;old&nbsp;behavior&nbsp;of&nbsp;this&nbsp;function&nbsp;to&nbsp;wrap&nbsp;round&nbsp;to&nbsp;negative&nbsp;values&nbsp;once&nbsp;the&nbsp;<br>input&nbsp;is&nbsp;past&nbsp;0xFFFFFFFF&nbsp;(ie&nbsp;1&lt;&lt;32&nbsp;==&nbsp;0)<br>
<br>Python 2.4 and up no longer does this, which means that the library fails to spot the <br>end of header bytes, as it tests for&nbsp;==&nbsp;-1&nbsp;and&nbsp;==-2&nbsp;(e.g.&nbsp;in&nbsp;loadfat()).<br> <br>This can result in an OverflowError being thrown, which is a problem for me when someone inputs an invalid file (I&#39;m actually seeing this on MS word files posted to a website as 
<br>images by mistake, but it could happen with a valid fpx file).<br><br>A simple way to get back to the previous correct behavior would be to patch as follows:<br><br>diff OleFileIO.py.new  OleFileIO.py<br>46c46,49<br>&lt; def i32(c, o = 0):
<br>&lt;     &nbsp;&nbsp;&nbsp;&nbsp;return ord(c[o])+(ord(c[o+1])&lt;&lt;8)+(ord(c[o+2])&lt;&lt;16)+(ord(c[o+3])&lt;&lt;24)<br>---<br>&gt; def i32(c, o = 0):<br>&gt;     &nbsp;&nbsp;&nbsp;&nbsp;ival = ord(c[o])+(ord(c[o+1])&lt;&lt;8)+(ord(c[o+2])&lt;&lt;16)+(ord(c[o+3])&lt;&lt;24)
<br>&gt;     &nbsp;&nbsp;&nbsp;&nbsp;if ival &gt; 0x80000000:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;         &nbsp;&nbsp;&nbsp;&nbsp;ival -= 0x100000000<br>&gt;     &nbsp;&nbsp;&nbsp;&nbsp;return ival<br><br>but a&nbsp;good alternative would be to fix all the tests in the library.<br><br>I guess this part of the library doesn&#39;t get exercised much :)
<br><br>BR,<br><br>Robert Bunting.<br>exoweb.<br><br><br> <br>