Comment 4 for bug 343403

Revision history for this message
Olivier Tilloy (osomon) wrote :

Fixed in the 0.2 branch. Note that IPTC tags now consistently handle their values, always expecting a list or tuple. They will not try to wrap a single value into a list (that would raise a TypeError).

The expected syntax for the original example would now look like this:

    import pyexiv2, datetime
    metadata = pyexiv2.ImageMetadata('sample.jpg')
    metadata.read()
    key = 'Iptc.Application2.DateCreated'
    values = [datetime.date.today()]
    if key in metadata.iptc_keys:
        metadata[key].values = values
    else:
        metadata[key] = pyexiv2.IptcTag(key, values)