PYTHONPATH, opensuse10.2, gtk not working

Silfheed silfheed at gmail.com
Fri Oct 5 16:04:29 EDT 2007


On Oct 4, 8:31 pm, Silfheed <silfh... at gmail.com> wrote:
> On Oct 4, 7:39 pm, Steve Holden <st... at holdenweb.com> wrote:
>
>
>
> > Silfheed wrote:
> > > Heyas
>
> > > So I'm trying to do two things, install a little gnome taskbar applet
> > > (timer-applet) that was written in python and experiment with writing
> > > python gtk apps.  I've installed (through yast) gtk, gtk2, gtk2-devel,
> > > python-gtk, python-gtk-devl, python-gtk-doc but I still cant get
> > > python to import gtk.  I set PYTHONPATH = /usr/lib/python2.5/site-
> > > packages/ and that got importing pygtk to work, but the little app I
> > > downloaded wants to import gtk and I just cant figure out what I'm
> > > supposed to set PYTHONPATH to in order to get `import gtk` to work.
> > > Anyone know what I'm doing wrong or missing?
>
> > > Thanks
>
> > set PYTHONPATH to /usr/lib/python2.5/lib/site-packages:gtk-root-dir
>
> > By the way, do you really think that it's necessary to put site-packages
> > on the path? You might find it's already on there as Python starts up.
>
> > You can tell by printing sys.path from Python.
>
> Yes, it actually requires adding the site-packages to the PYTHONPATH
> to get pygtk to work.  So far I've managed to get gtk to give a
> different error when I added the site-packages/gtk-2.0/ directory (the
> only gtk-like thing in the site-packages) to the PYTHONPATH
> `ImportError: gobject/_gobject.so: undefined symbol:
> PyUnicodeUCS4_FromObject`.   I'll have to check the path when I get
> home to see what it actually has within it and work from there.
>
> Thanks.

So after checking sys.path and snooping around a bit more, it turns
out that I have two python site-package directories... one in /usr/lib
and one in /usr/local/lib.. One is automatically stuck into sys.path
(but allowed root access only) while the other is not.

I dunno why this is, but is there a way to get python to see both of
these automatically (without PYTHONPATH?)  Not that this solves my
problem since after changing the permissions to world readable on the
sys.path listed /usr/lib/python2.5/site-packages, it still wont let me
import gtk.  This is all after installing everything with yast (which
says that I have gtk)..




More information about the Python-list mailing list