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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!feeder3.eweka.nl!hq-usenetpeers.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!news.Uni-Mainz.DE!not-for-mail
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 Tue, 13 Dec 2011 17:38:10 +0100
Organization Johannes Gutenberg-Universitaet Mainz, Germany
Lines 16
Message-ID <87y5ug2zrh.fsf@jubold.box> (permalink)
References <jc7t7n$u95$1@tdi.cu.mi.it>
NNTP-Posting-Host zdv-vpn1-38-65.zdv.uni-mainz.de
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace infosys-01.zdv.uni-mainz.de 1323794290 10081 134.93.38.65 (13 Dec 2011 16:38:10 GMT)
X-Complaints-To news@uni-mainz.de
NNTP-Posting-Date Tue, 13 Dec 2011 16:38:10 +0000 (UTC)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
Cancel-Lock sha1:bFgAoxruO2irU5KeDKrt3uJR/tw=
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17150

Show key headers only | 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