Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17149
| 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 | 2011-12-13 16:29 +0000 |
| Organization | Norwich University |
| Message-ID | <9kpcqkFcoU1@mid.individual.net> (permalink) |
| References | <jc7t7n$u95$1@tdi.cu.mi.it> |
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