2.27.90 => 2.27.91 regression: AttributeError: type object 'Widget' has no attribute '__info__'

Bug #729933 reported by Jason Gerard DeRose
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pygobject (Ubuntu)
Invalid
Low
Unassigned

Bug Description

Came across this as I was working on dmedia. This is a simple example that triggers it:

###
import sys

import gtk
from gi.repository import WebKit

window = gtk.Window()
window.set_title('test')
window.set_default_size(800, 450)
window.connect('destroy', gtk.main_quit)

view = WebKit.WebView()
window.add(view)

view.load_uri(sys.argv[1])

window.show_all()
gtk.main()
###

The above works with pygobject 2.27.90, but with 2.27.91 I get an attribute error:

Traceback (most recent call last):
  File "./dummy-client", line 34, in <module>
    view = WebKit.WebView()
  File "/usr/lib/pymodules/python2.7/gi/module.py", line 261, in __getattr__
    return getattr(self._introspection_module, name)
  File "/usr/lib/pymodules/python2.7/gi/module.py", line 142, in __getattr__
    parent = get_parent_for_object(info)
  File "/usr/lib/pymodules/python2.7/gi/module.py", line 67, in get_parent_for_object
    module = __import__('gi.repository.%s' % namespace, fromlist=[name])
  File "/usr/lib/pymodules/python2.7/gi/importer.py", line 77, in load_module
    dynamic_module._load()
  File "/usr/lib/pymodules/python2.7/gi/module.py", line 242, in _load
    overrides_modules = __import__('gi.overrides', fromlist=[self._namespace])
  File "/usr/lib/pymodules/python2.7/gi/overrides/Gtk.py", line 46, in <module>
    Widget = override(Widget)
  File "/usr/lib/pymodules/python2.7/gi/overrides/__init__.py", line 63, in override
    registry.register(type_)
  File "/usr/lib/pymodules/python2.7/gi/overrides/__init__.py", line 38, in register
    self[override_class] = override_class
  File "/usr/lib/pymodules/python2.7/gi/overrides/__init__.py", line 20, in __setitem__
    info = getattr(value, '__info__')
AttributeError: type object 'Widget' has no attribute '__info__'

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: python-gobject 2.27.91-0ubuntu1
ProcVersionSignature: Ubuntu 2.6.38-5.32-generic 2.6.38-rc6
Uname: Linux 2.6.38-5-generic x86_64
Architecture: amd64
CheckboxSubmission: fdbdfcded0c0bb479a6b52e9ec5af131
CheckboxSystem: edda5d4f616ca792bf437989cb597002
Date: Sat Mar 5 16:38:46 2011
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007.1)
ProcEnviron:
 LANGUAGE=en_US:en
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: pygobject
UpgradeStatus: Upgraded to natty on 2011-01-30 (34 days ago)

Revision history for this message
Jason Gerard DeRose (jderose) wrote :
Revision history for this message
Jason Gerard DeRose (jderose) wrote :
Revision history for this message
Mostafa Razavi (elektito) wrote :

The weird thing about this bug is that the import works fine on a second attempt. So for example if I run "from gi.repository import Gtk" I get an "AttributeError: type object 'Widget' has no attribute '__info__'." Now when I rerun it, everything works fine. Subsequent imports also need to be repeated in order to work.

Revision history for this message
Pedro Villavicencio (pedro) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. The issue that you reported is one that should be reproducible with the live environment of the Desktop CD of the stable release - Oneiric Ocelot. It would help us greatly if you could test with it so we can work on getting it fixed. You can find out more about the development release at http://www.ubuntu.com/testing/ . Thanks again and we appreciate your help.

Changed in pygobject (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Ah, I didn't realize this at the time, but this bug is actually invalid as PyGI isn't meant to play nice with static bindings like PyGTK. It was pretty much by accident when it worked before.

The pygobject version in Oneiric doesn't let you dangerously mix them anymore:

>>> import gtk
>>> from gi.repository import WebKit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/gi/__init__.py", line 23, in <module>
    from ._gi import _API, Repository
ImportError: could not import gobject (error was: ImportError('When using gi.repository you must not import static modules like "gobject". Please change all occurrences of "import gobject" to "from gi.repository import GObject".',))

Changed in pygobject (Ubuntu):
status: Incomplete → Invalid
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.