Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17149
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Neil Cerutti <neilc@norwich.edu> |
| Newsgroups | comp.lang.python |
| Subject | Re: Getting the current directory path and the path where python script is saved |
| Date | 13 Dec 2011 16:29:08 GMT |
| Organization | Norwich University |
| Lines | 18 |
| Message-ID | <9kpcqkFcoU1@mid.individual.net> (permalink) |
| References | <jc7t7n$u95$1@tdi.cu.mi.it> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net RCjCqHnt70rv6SRazoDpkASxeP8WcjwzAocUN+601RnEOEXqO6 |
| Cancel-Lock | sha1:71oCp54FadTkzvByqTt/b9qYGYw= |
| User-Agent | slrn/0.9.9p1/mm/ao (Win32) |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17149 |
Show key headers only | View raw
On 2011-12-13, gialloporpora <gialloporpora@gmail.com> wrote: > Dear all, > I would like to create a little script to rename my files, I think to > use argparse module to create it. > I would like to know how to obtain the path where script is executed and > the path where the file script is stored. > > For example, if I save my script in c:\python27 and I put the > directory in %path% I can execute it from any folder, I would > like to get the two directory path. Current working directory is available with os.getcwd() The location of the script you are running may be available as os.path.basename(sys.argv[0]). -- Neil Cerutti
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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