ron.longo wrote:
> Nope, maybe I'm not explaining myself well.
> 
> When I do os.getenv('HOME') I get back None.
> 
> According to the docs, 'HOME' is the user's home directory on some
> platforms.  Which is not what I want.
> 
> What I want is the directory in which an application's main .py file
> resides.  That is, when I type: python MyApp.py, I want to know in which
> directory does MyApp.py reside?

Shane is right.

>>> print __file__

>>> print modulename.__file__

Just call os.path.dirname() on __file__ to get the directory.
-- 
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to