'could not open display' error when import gtk - how fix?

rainbow.cougar at gmail.com rainbow.cougar at gmail.com
Wed Feb 15 09:49:29 EST 2006


seberino at spawar.navy.mil wrote:
> Why can't I import gtk (pygtk) module?  It appears gtk module want X
> perms?
>
>
> >>> import gtk
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.3/site-packages/gtk-2.0/gtk/__init__.py", line
> 37, in ?    from _gtk import *
> RuntimeError: could not open display

An error like this usually happens when X security is on, or the
display name isn't known.

#before you run it, try (for csh):
setenv DISPLAY host:0.0
#where host is your computers name

#If that doesn't get it, do:
xhost +




More information about the Python-list mailing list