Getting the current directory path and the path where python script is saved

Thomas Bach bachth at uni-mainz.de
Tue Dec 13 11:38:10 EST 2011


gialloporpora <gialloporpora at gmail.com> writes:

> I would like to know how to obtain the path where script is executed
> and the path where the file script is stored.

Does this help:

In [16]: import os

In [19]: os.getcwd()
Out[19]: '/home/vince'

In [21]: os.__file__
Out[21]: '/home/vince/src/pyramid_install/lib/python2.7/os.pyc'

regards



More information about the Python-list mailing list