Exif headers with zero-denominator rational (fraction) types raise DivideByZero exception unnecessarily
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyexiv2 |
Fix Released
|
Medium
|
Olivier Tilloy |
Bug Description
Applies to pyexiv2 version 0.3
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
distributed with Ubuntu Natty Narwhal
#!/bin/python
# show_bug2.py
import pyexiv2
im = pyexiv2.
im.read()
k = 'Exif.Nikon3.
s = im[k].value;
print "{0}: {1}".format(k,s)
hobs@hobs-
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (33, 0))
-------
ExifValueError Traceback (most recent call last)
/media/
4 im.read()
5 k = 'Exif.Nikon3.
----> 6 s = im[k].value;
7 print "{0}: {1}".format(k,s)
8
/usr/lib/
187 def _get_value(self):
188 if self._value_cookie:
--> 189 self._compute_
190 return self._value
191
/usr/lib/
182 return
183
--> 184 self._value = self._convert_
185 self._value_cookie = False
186
/usr/lib/
320 r = make_fraction(
321 except (ValueError, ZeroDivisionError):
--> 322 raise ExifValueError(
323 else:
324 if self.type == 'Rational' and r.numerator < 0:
ExifValueError: Invalid value for EXIF type [Rational]: [0/0]
WARNING: Failure executing file: <show_bug2.py>
Changed in pyexiv2: | |
assignee: | Hobson Lane (hobs) → Olivier Tilloy (osomon) |
status: | Confirmed → Fix Committed |
Changed in pyexiv2: | |
milestone: | none → 0.3.1 |
Changed in pyexiv2: | |
status: | Fix Committed → Fix Released |
Here's a work-around patch for this bug and a related bug, #781464.