Re: Find directory name of file?

2006-01-30 Thread ngw
-veracon <[EMAIL PROTECTED]>:
> I'm pretty new at Python, so I have no idea how to do this: How do I
> find the name of the directory that contains the application currently
> being executed (e.g. if the file is /home/user/file.py, I want to get
> the /home/user part)?

Try os.path.dirname (__file__)

HTH,
  ngw
-- 
http://mail.python.org/mailman/listinfo/python-list


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

2006-02-15 Thread ngw
[EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> Why can't I import gtk (pygtk) module?  It appears gtk module want X
> perms?
>
>
>>>> import gtk
> Traceback (most recent call last):
>   File "", 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

You have to run the pyshell under the right permissions. Are you
trying to import pygtk from the root/toor account ?

  ngw
-- 
http://mail.python.org/mailman/listinfo/python-list