GTK import doesn't import first time

Dennis dsylvest at adelphia.net
Mon Aug 18 18:00:36 EDT 2003


John Hunter <jdhunter at ace.bsd.uchicago.edu> wrote in message news:<mailman.1061231971.3803.python-list at python.org>...
> >>>>> "Dennis" == Dennis  <dsylvest at adelphia.net> writes:
> 
>     Dennis> I've downloaded and installed per the instructions the
>     Dennis> pyGTK and GTK+ for win32 from the above locations.
>     Dennis> Folowing the instructions, I import pygtk first, run
>     Dennis> pygtk.require('2.0') second and then import gtk.  I
>     Dennis> receive an error on the import gtk the first time, but
>     Dennis> immediately after, if I import again it works.  Even if I
>     Dennis> don't impo0rt pyGTK at all and only import gtk, I get the
>     Dennis> same results.  Any ideas?
> 
> The reason it "works" the second time is that it doesn't try and
> import it again after the first.  So it did not really work.
> 
> Did you download and install the GTK runtime from
> http://www.dropline.net/gtk? If you installed it to to C:\GTK, you'll
> need C:\GTK\bin and C:\GTK\lib in your path.

Yes, as stated in the post I installed GTK runtime.  Also, GTK\2.0 is
in my path and verified with:

>>> import os
>>> print '\n'.join(os.environ['PATH'].split(';'))

which provided (amongst other entiries)
...
D:\GTK\2.0\lib
D:\GTK\2.0\bin
...

BUT, searching around google a little more I notice that a LOT of
people have had this problem and the response you've provided is
pretty much the same.  Then I found an answer that worked here:

http://www.daa.com.au/pipermail/pygtk/2003-January/004329.html 
(THANKS Jamey!)

Seems that previous versions installed the dll in C:\windows\system32
and python was finding the old dll since the windows directory is
earlier in the path.  Had I remembered (or known - don't know which)
that the directory GTK installs dll's in is now different, I would
have caught this.  D'oh!  Removed the old dll and all is well.

Dennis S.
> 
> John Hunter




More information about the Python-list mailing list