Il giorno domenica 19 agosto 2012 22:42:16 UTC+2, kj ha scritto: > As far as I've been able to determine, Python does not remember > > (immutably, that is) the working directory at the program's start-up, > > or, if it does, it does not officially expose this information. > > > > Does anyone know why this is? Is there a PEP stating the rationale > > for it? > > > > Thanks!
You can obtain the working directory with os.getcwd(). giacomo@jack-laptop:~$ echo 'import os; print os.getcwd()' > testing-dir.py giacomo@jack-laptop:~$ python testing-dir.py /home/giacomo giacomo@jack-laptop:~$ cd Documenti giacomo@jack-laptop:~/Documenti$ python ../testing-dir.py /home/giacomo/Documenti giacomo@jack-laptop:~/Documenti$ Obviously using os.chdir() will change the working directory, and the os.getcwd() will not be the start-up working directory, but if you need the start-up working directory you can get it at start-up and save it in some constant. -- http://mail.python.org/mailman/listinfo/python-list