GNOME Bugzilla – Bug 349026
reloading gtk fails
Last modified: 2006-08-05 15:59:27 UTC
importing gtk again if the first import fails (say if DISPLAY is wrong) breaks with: Traceback (most recent call last):
+ Trace 69720
reload(gtk)
from gtk import _gtk
This also happens with: import gtk reload(gtk) While this looks unusual its used in fedora-config-display to first try to connect to the existing display, and if that fails start a new X server to connect to. The reason this happens is that the above mentioned file deletes gtk._gtk to avoid users accessing it. J5 and I came up with a hack that fixes this. Basically you resurrect the gtk._gtk from the sys.modules hashtable the second time.
Created attachment 69780 [details] [review] crazy reload hack
*** Bug 348691 has been marked as a duplicate of this bug. ***
(In reply to comment #1) > Created an attachment (id=69780) [edit] > crazy reload hack I checked in a different (simplified) version of the patch that makes it possible to reload the gtk module: Checking in ChangeLog; /cvs/gnome/pygtk/ChangeLog,v <-- ChangeLog new revision: 1.1592; previous revision: 1.1591 done Checking in gtk/__init__.py; /cvs/gnome/pygtk/gtk/__init__.py,v <-- __init__.py new revision: 1.49; previous revision: 1.48 done Checking in tests/test_api.py; /cvs/gnome/pygtk/tests/test_api.py,v <-- test_api.py new revision: 1.4; previous revision: 1.3 done