2

I edited the question for being too opinion based.

I am desperately searching for a library to manipulate (read/write) image metadata with Python 3.6 on Mac OS X El Capitan. I tried GExiv2. After approximately two hours I was able to install it and get it running, but it keeps generating further errors within Python3 I can't solve. I was not at all able to install py3exiv2. I could'nt find further alternatives (for Python3) to the two libraries mentioned.

Problems with GExiv2:

I first import the modules:

>>> import gi
>>> gi.require_version('GExiv2', '0.10.04')
>>> from gi.repository.GExiv2 import Metadata

Then I produce a Metadata-object and open the image:

>>> m =  Metadata()
>>> m.open_path('Abb_WS_di-34_561_01.jpg')
True

When, however, I try to use the Metadata-Objects methods like m.get_tags(). I get an Error:

>>> m.get_tags()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Metadata' object has no attribute 'get_tags'

.get_tags() sums up the "lower" get_XYZ_tags()methods and returns the concatenated lists produced by these methods. Calling a "lower" method like m.get_iptc_tags() works:

>>> m.get_iptc_tags()
['Iptc.Application2.Byline', 'Iptc.Application2.City',     'Iptc.Application2.CountryCode', … ]

>>> m.get_tag_string('Iptc.Application2.CountryName')
'Deutschland'

I looked in the module and made sure that the methods are there. Maybe someone can give me a clue …

Thanks in advance!

hou2zi0
  • 71
  • 5
  • HI! Welcom to SO. PLease note that "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – rll Mar 27 '17 at 15:00
  • Could recreate the example from https://bugzilla.gnome.org/show_bug.cgi?id=775249#c0 ? Does it work? I have my doubts about using empty initialization of ``Metadata()``. – mcepl Mar 28 '17 at 04:45
  • @mcepl: @mcepl The empty `Metadata()`is a work around for another error (maybe this work around does not function really well): >>> exif = GExiv2.Metadata('IMG_1234.JPG') Traceback (most recent call last): File "", line 1, in TypeError: GObject.__init__() takes exactly 0 arguments (1 given) The discussion in the link you've provided did not help me solve my problem mentioned above. – hou2zi0 Mar 29 '17 at 05:50

0 Answers0