After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 576546 - Problems with Python 2.6
Problems with Python 2.6
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-python
git master
Other Linux
: Urgent blocker
: 0.10.15
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-03-24 10:44 UTC by Jan Schmidt
Modified: 2009-04-11 14:25 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed fix (8.27 KB, patch)
2009-03-25 18:22 UTC, Alessandro Decina
accepted-commit_now Details | Review
Updated version with suggestion from Phil (8.60 KB, patch)
2009-04-11 14:22 UTC, Edward Hervey
committed Details | Review

Description Jan Schmidt 2009-03-24 10:44:16 UTC
*** Rebuilding plugin inspection files ***
Traceback (most recent call last):
  • File "../../common/gst-xmlinspect.py", line 13 in <module>
    import gst
  • File "/home/jan/devel/gstreamer/head/gst-python/gst/__init__.py", line 194 in <module>
    from _gst import *
  • File "/usr/lib/python2.6/ihooks.py", line 406 in import_module
    q, tail = self.find_head_package(parent, str(name))
  • File "/usr/lib/python2.6/ihooks.py", line 442 in find_head_package
    q = self.import_it(head, qname, parent)
  • File "/usr/lib/python2.6/ihooks.py", line 497 in import_it
    m = self.loader.load_module(fqname, stuff)
  • File "/usr/lib/python2.6/ihooks.py", line 270 in load_module
    m = self.hooks.load_dynamic(name, filename, file)
  • File "/home/jan/devel/gstreamer/head/gst-python/gstltihooks.py", line 61 in load_dynamic
    return ihooks.Hooks.load_dynamic(self, name, filename, file)
  • File "/usr/lib/python2.6/ihooks.py", line 174 in load_dynamic
    return imp.load_dynamic(name, filename, file)
ImportError: could not import gobject (error was: 'import_module() takes at most 5 arguments (6 given)')
make[3]: *** [inspect-build.stamp] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

From IRC:

<mnauw> thaytan, bilboed-pi: seems like http://bugs.python.org/i
ssue4244
<bilboed-pi>    mnauw, erf... undocumented and deprecated
<mnauw> I could workaround by adding a level=-1 parameter to the
 import_module functions in /usr/lib/python2.6/ihooks.py (on my installation at 
<bilboed-pi>    mnauw, I guess we should switch to something else :)
Comment 1 Alessandro Decina 2009-03-25 18:22:51 UTC
Created attachment 131364 [details] [review]
proposed fix

I reworked the import thingy.
I only tried it with python2.5. Please try with 2.6?
Comment 2 Mark Nauwelaerts 2009-03-25 21:51:56 UTC
Works for me on python 2.6
Comment 3 Jan Schmidt 2009-03-26 22:40:28 UTC
Gets rid of the ihooks error, of course, but I still can't run gst-python uninstalled:

Python 2.6 (r26:66714, Feb 26 2009, 17:32:42) 
[GCC 4.4.0 20090219 (Red Hat 4.4.0-0.21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gst
i>>> import gst.pbutils
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
ImportError: No module named pbutils
>>> 

What info would help you?
Comment 4 Edward Hervey 2009-03-27 07:56:03 UTC
The last issue (pbutils) is a problem we've been having forever with submodules when running uninstalled (or running it from gst-python's directory).

The reason why you can "import gst.interfaces" ... is because gst/__init__.py imports that module (line 195). I'm not 100% sure if that's the right thing to do (that means loading all the submodules, which also means loading all the C .so they expose).

The ltihook patch can go in though. Need to think a bit more about the submodule issue.
Comment 5 Philippe Normand 2009-04-10 12:39:36 UTC
What about importing those submodules from gst/__init__.py only when gstltihooks is used? Like:

if __gstltihooks_used__:
   import pbutils
   # and some more

Comment 6 Edward Hervey 2009-04-11 14:22:13 UTC
Created attachment 132515 [details] [review]
Updated version with suggestion from Phil
Comment 7 Edward Hervey 2009-04-11 14:25:36 UTC
commit 1cd54e6d4565308d6a8eb3dd2bb1f214f8f38aca
Author: Alessandro Decina <alessandro.decina@collabora.co.uk>
Date:   Sat Apr 11 16:20:11 2009 +0200

    Fix uninstalled usage with python 2.6. Fixes #576546
    
    Also imports submodules as mentionned by Philippe Normand.