Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5314 closed defect (fixed)

ZeroDivisionError in exif.py

Reported by: ayleph Owned by:
Priority: major Milestone: 0.8.0
Component: programming Keywords: exif, processing, upload, error
Cc: Parent Tickets:

Description

A user tried to upload a couple of images that resulted in the following error in my celery logs.

[2015-04-08 15:55:15,419: ERROR/MainProcess] Task mediagoblin.processing.task.ProcessMedia[5210c290-e679-4788-afa2-5e4020b46ba4] raised unexpected: ZeroDivisionError('float division by zero',)
Traceback (most recent call last):
  File "/path/to/mediagoblin/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/app/trace.py", line 240, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/path/to/mediagoblin/lib/python2.7/site-packages/celery-3.1.17-py2.7.egg/celery/app/trace.py", line 438, in __protected_call__
    return self.run(*args, **kwargs)
  File "/path/to/mediagoblin/mediagoblin/processing/task.py", line 101, in run
    processor.process(**reprocess_info)
  File "/path/to/mediagoblin/mediagoblin/media_types/image/processing.py", line 320, in process
    self.extract_metadata('original')
  File "/path/to/mediagoblin/mediagoblin/media_types/image/processing.py", line 231, in extract_metadata
    gps_data = get_gps_data(self.exif_tags)
  File "/path/to/mediagoblin/mediagoblin/tools/exif.py", line 161, in get_gps_data
    )(dat.values)
  File "/path/to/mediagoblin/mediagoblin/tools/exif.py", line 160, in <lambda>
    + (float(v[2].num) / float(v[2].den) / (60 * 60))
ZeroDivisionError: float division by zero

The following GPS information was logged during processing of one of these images.

GPS SubIFD at offset 10616:
GPSVersionID: (0x0000) Byte=[2, 2, 0, 0] @ 10626
GPSLatitudeRef: (0x0001) ASCII= @ 10638
GPSLatitude: (0x0002) Ratio=[0/0, 0/0, 0/0] @ 10730
GPSLongitudeRef: (0x0003) ASCII= @ 10662
GPSLongitude: (0x0004) Ratio=[0/0, 0/0, 0/0] @ 10754
GPSStatus: (0x0009) ASCII= @ 10686
GPSImgDirectionRef: (0x0010) ASCII= @ 10698
GPSImgDirection: (0x0011) Ratio=267 @ 10778
GPSAreaInformation: (0x001C) Undefined=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... ] @ 10786
GPSInfo: (0x8825) Long=10616 @ 150

Change History (3)

comment:1 by ayleph, 10 years ago

The specific image which caused the errors logged above is available at the link below.

http://files.goblinrefuge.com/download/P4060725.JPG

comment:2 by Christopher Allan Webber, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in fd4ddeb!

comment:3 by ayleph, 10 years ago

Fix mentioned above works for me!

Note: See TracTickets for help on using tickets.