Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17150

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

From Thomas Bach <bachth@uni-mainz.de>
Newsgroups comp.lang.python
Subject Re: Getting the current directory path and the path where python script is saved
Date 2011-12-13 17:38 +0100
Organization Johannes Gutenberg-Universitaet Mainz, Germany
Message-ID <87y5ug2zrh.fsf@jubold.box> (permalink)
References <jc7t7n$u95$1@tdi.cu.mi.it>

Show all headers | View raw


gialloporpora <gialloporpora@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Getting the current directory path and the path where python script is saved gialloporpora <gialloporpora@gmail.com> - 2011-12-13 17:04 +0100
  Re: Getting the current directory path and the path where python script is saved Neil Cerutti <neilc@norwich.edu> - 2011-12-13 16:29 +0000
    Re: Getting the current directory path and the path where python script is saved gialloporpora <gialloporpora@gmail.com> - 2011-12-13 22:39 +0100
  Re: Getting the current directory path and the path where python script is saved Thomas Bach <bachth@uni-mainz.de> - 2011-12-13 17:38 +0100

csiph-web