Timezone info is not correctly passed to libexiv2 when writing IPTC and XMP tags
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pyexiv2 |
Fix Released
|
Medium
|
Olivier Tilloy |
Bug Description
(Originally reported by e-mail by Petri Damstén, thanks Petri!)
For datetime.tzinfo subclasses that are not pyexiv2.
Example script, with any image file (needs python-tz):
import pyexiv2
import pytz
from datetime import datetime
m=pyexiv2.
m.read()
m['Xmp.
m.write()
m=pyexiv2.
m.read()
print m['Xmp.
Expected result: prints the value of the tag with the correct timezone information.
Current result: "XmpValueError: Invalid value for XMP type [Date]: [2011-06-
Changed in pyexiv2: | |
assignee: | nobody → Olivier Tilloy (osomon) |
status: | Confirmed → In Progress |
Changed in pyexiv2: | |
milestone: | none → 0.3.1 |
Changed in pyexiv2: | |
status: | Fix Committed → Fix Released |
The root cause of the issue is the code that converts a datetime object to a string to be passed to libexiv2. It incorrectly assumes that if a timezone object is present, it must be an instance of pyexiv2. utils.FixedOffs et, which is certainly not true when e.g. using pytz. The code should use "%z", not "%Z", to print out the timezone info.