[pygtk] ltihooks problem
Brad Schick
schickb at gmail.com
Sat Jul 14 16:31:38 WST 2007
I'm new to both python and gtk+, so hopefully I'm not missing something obvious.
I'm writing a graphic extension to mercurial [1] using pygtk 2.10.4
under winxp and python 2.5.1. When I start my extension directly from
the command-line it all works fine. But when I build and install
mercurial with my new extension, I get this error when mercurial loads
it:
"No module named ltihooks"
The problem is in site-packages\gtk-2.0\gtk\__init__.py. The
"ltihooks" statement at the top that attempts to trigger an exception
after importing ltihooks never actually generates an exception, so the
ltihooks name is never set to None. That causes an ImportError
exception later when ltihooks.uninstall() is called.
Two potential solutions: 1) Wrap the call to ltihooks.uinstall() with
try/except. 2) After the import, make a call that triggers the
exception since the plain "ltihooks" statement does not seem to be
enough.
I tried solution #1 and it worked, but I don't fully grok the
situation. For example, why doesn't the gtk\__init__.py run when I
start my extension directly from the command-line? Also why can't
ltihooks be located... I see it in the pygtk sources?
-Brad
[1] http://www.selenic.com/mercurial/wiki/
More information about the pygtk
mailing list