PYTHONPATH, opensuse10.2, gtk not working

S

Silfheed

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
 
S

Steve Holden

Silfheed said:
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.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline so I couldn't cat it
 
S

Silfheed

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.
 
S

Silfheed

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)..
 
S

Silfheed

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)..

Well.. I suppose a logical explanation would be two different installs
of python.. sorry for the noise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top