Comment 6 for bug 389960

Revision history for this message
Jacques-D. Piguet (jacques-piguet) wrote : Re: [Bug 389960] Re: Can't write geotag data

Le lundi 18 janvier 2010 à 22:23 +0000, clanmills a écrit :
> Jacques
>
> I didn't look at this because I thought Olivier submitted a fix last
> week.
>
> I'm not sure I've understood what is being discussed. Is it
> pyexiv2.Rational that is wrong, all Latitude values or what?
>
> Can you:
> 1) Shorten the code to the minimum
> 2) Explain what happens, what you expect and why it is wrong.
> 3) Is it only 2,1 that's wrong or all Rational Numbers or what?
> 4) Can you use the surd.py code to handle the rational numbers instead of pyexiv2.Rational
>
> Olivier. Did you submit a fix to the 0.2 branch (and/or 0.1.3?)
>
> Robin
>

Hi Robin,

The problem occurs by setting the value to an existing tag:

1. Create an image object and read the metadata:
import pyexiv2
img=pyexiv2.Image('IMG_0580.JPG')
img.readMetadata()

2. Check the longitude tag (as expected, the result is a tuple of 3
rationals):
print img['Exif.GPSInfo.GPSLongitude']
(<pyexiv2.Rational instance at 0xa560dac>, <pyexiv2.Rational instance at
0xa560c6c>, <pyexiv2.Rational instance at 0xa560e6c>)

3. Modify the tag:
img['Exif.GPSInfo.GPSLongitude']=(pyexiv2.Rational(3,1),pyexiv2.Rational(44,1),pyexiv2.Rational(5615,100))

4. Check the modification:
print img['Exif.GPSInfo.GPSLongitude']
0/1

5. Here is the problem: instead of 3 rationals there is only 1, and with
a dummy value. I think that the rationals from pyexiv2.Rational are
correct, but the set operation fails somewhere.

I am using only standart packages from the Ubuntu 9.10 repositories, but
I will try to use surd.py

BR, Jacques-D.