[pygtk] Python code works in terminal but not with shortcut on the
gnome panal
Edward A Robinson
earobinson at gmail.com
Fri Mar 30 02:13:15 WST 2007
The following python code seems to work for me if I run it from the
gnome-terminal but not if I run it from the gnome-panel anyone have
any ideas why this is?
I save the code to ~/.exampleNet.py and in the gnome terminal I am
able to type "./exampleNet.py" and the code will display the google
home page html code. But If I create a custom application launcher to
run "python /home/earobinson/exampleNet.py" on the gnome-panel I get
the error message
Some background I have setup a network proxy and I think that that is
whats getting in the way (When I run the program from the gnome
terminal it detects my proxy but when I run it from the panel it dose
not)
Also the weather applet for the panel works for me.
Code
================================================
#!/usr/bin/env python
import urllib
import gtk
main_window = gtk.Window()
main_window.connect('destroy', lambda *w: gtk.main_quit())
try:
url_content = urllib.urlopen('http://www.google.com')
main_window.add(gtk.Label(url_content.read()))
except IOError:
main_window.add(gtk.Label(' Error '))
main_window.show_all()
gtk.main()
================================================
Thanks for any help your can provide.
--
Edward A Robinson
More information about the pygtk
mailing list