There's a bug in EXIF parsing in mmpython 0.4.8.  I didn't check CVS, so
maybe this was fixed.  Here's a patch.  I also put a try/except around
EXIF.process_file() so that in case that function fails,
mmpython.parse() will still return a JPGInfo instance.

Cheers,
Jason.


--- mmpython-0.4.8.old/image/EXIF.py	2004-11-14 14:38:39.000000000 -0500
+++ mmpython-0.4.8/image/EXIF.py	2005-05-01 16:22:37.000000000 -0400
@@ -644,7 +644,7 @@
     x=0
     y=0L
     for c in str:
-        x=x | (long(ord(c)), y)
+        x=x | (ord(c) << y)
         y=y+8
     return x
 
--- mmpython-0.4.8.old/image/jpginfo.py	2004-05-20 11:56:31.000000000 -0400
+++ mmpython-0.4.8/image/jpginfo.py	2005-05-01 16:29:10.000000000 -0400
@@ -152,7 +152,10 @@
                 file.seek(seglen-2,1)
             app = file.read(4)
         file.seek(0)        
-        exif_info = EXIF.process_file(file)
+        try:
+            exif_info = EXIF.process_file(file)
+        except:
+            exif_info = None
         if exif_info:
             self.setitem( 'date', exif_info, 'Image DateTime' )            
             self.setitem( 'artist', exif_info, 'Image Artist' )

Reply via email to