Cannot import in python2.7

Bug #1234422 reported by Alessandro Tanasi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gexiv2 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I am totally unable to use this library in python 2.7.
With the latest ubuntu package i am unable to:

>>> from gi.repository import GExiv2

I got a:

ImportError: cannot import name GExiv2

# python2.7
Python 2.7.4 (default, Sep 26 2013, 03:20:56)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GExiv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named gi.repository

The import works well with python3.

# python3
Python 3.3.1 (default, Sep 25 2013, 19:30:50)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import GExiv2
>>>

But if i try to locate:

$ locate GExiv2.py
/usr/lib/python2.7/dist-packages/gi/overrides/GExiv2.py
/usr/lib/python3/dist-packages/gi/overrides/GExiv2.py

# dpkg -l| grep exiv
ii gir1.2-gexiv2-0.4 0.6.1-0ubuntu1 i386 GObject introspection data for the gexiv2 library
ii libexiv2-12 0.23-1 i386 EXIF/IPTC metadata manipulation library
ii libgexiv2-2 0.6.1-0ubuntu1 i386 GObject-based wrapper around the Exiv2 library

Revision history for this message
Jim Nelson (yorba-jim) wrote :

This was reported by Alessandro upstream at http://redmine.yorba.org/issues/7582

Robert Park replied to your problem, Alessandro, suggesting you try installing python.gi. Hve you tried that?

Revision history for this message
Alessandro Tanasi (jekil) wrote :

Yes, it solved. Why this is not a package requirement?

Revision history for this message
Jim Nelson (yorba-jim) wrote :

Because gexiv2 is not a Python library, it's designed for many languages to use.

Perhaps the Python bindings should be packaged separately with the appropriate dependencies in place, but I'm not sure of that. For example, gexiv2 also ships with Vala bindings, but it doesn't (nor should it) require Vala to be installed.

Changed in gexiv2 (Ubuntu):
status: New → Invalid
Revision history for this message
Robert Bruce Park (robru) wrote :

Yeah, it's a bit tricky. Technically in order to use everything installed by gexiv2, we'd need to depend on both python-gi and python3-gi. But then that would require *everybody* to have *both* python2 and python3. Well, not everybody has python3, and hopefully soon there will start to be people who don't have python2! I guess those things could be added as Recommends: but they should not be hard deps.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.