← Back to team overview

pyexiv2-developers team mailing list archive

Test with python3

 

Hi Olivier,
Hi all,

Ubuntu 12.04 provide all necessary for the compilation of boost with Python3
(maybe Oneiric too, I've skipped this version)

Following the same procedure as describe into the bug
https://bugs.launchpad.net/pyexiv2/+bug/824440,
pyexiv2 works fine with Python3 but read only. Same as with Archlinux.

It seems the problem is in the data format. Unicode, ASCII, bytes ...

Some examples:

tag = "Exif.Photo.UserComment"
val = "Soirée d'été"  # <class str>

----------------------------------------------
data[tag].value = val
Error: Python argument types in
    _ExifTag._setRawValue(_ExifTag, bytes)
did not match C++ signature:
    _setRawValue(exiv2wrapper::ExifTag {lvalue}, std::string)
----------------------------------------------

val = unicodedata.normalize('NFKD', val).encode('ascii', 'ignore')  #
<class 'bytes'>
data[tag].value = val
Error: Python argument types in
    _ExifTag._setRawValue(_ExifTag, bytes)
did not match C++ signature:
    _setRawValue(exiv2wrapper::ExifTag {lvalue}, std::string)
-----------------------------------------------

data[tag].value = '{0}'.format(val)
Error: Python argument types in
    _ExifTag._setRawValue(_ExifTag, bytes)
did not match C++ signature:
    _setRawValue(exiv2wrapper::ExifTag {lvalue}, std::string)
-----------------------------------------------

tag = 'Exif.GPSInfo.GPSLatitudeRef'
latref = 'N' # <class str>

Traceback (most recent call last):
    ...
  File "/home/vincent/oqapy3/metadatas.py", line 406, in modify_geotags
    self.datas[tag].value = latref
  File "/usr/lib/python3.2/dist-packages/pyexiv2/exif.py", line 198, in
_set_value
    self.raw_value = self._convert_to_string(value)
  File "/usr/lib/python3.2/dist-packages/pyexiv2/exif.py", line 164, in
_set_raw_value
    self._tag._setRawValue(value)
Boost.Python.ArgumentError: Python argument types in
    _ExifTag._setRawValue(_ExifTag, bytes)
did not match C++ signature:
    _setRawValue(exiv2wrapper::ExifTag {lvalue}, std::string)
---------------------------------------------

tag = 'Exif.GPSInfo.GPSLatitude'
val = [Rational(50, 1), Rational(49, 1), Rational(54, 1)] # <class 'list'>
data[tag].value = val

... No error, great!

So, may I perform other tests? feel free to ask me, I've a machine only
for testing.

Best regards.
Vincent



-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte+7
<https://launchpad.net/qarte+7> . PaQager <https://launchpad.net/paqager>



Follow ups