Why doesn't Python remember the initial directory?

Nobody nobody at nowhere.com
Sun Aug 19 20:45:22 EDT 2012


On Sun, 19 Aug 2012 14:01:15 -0700, Giacomo Alzetta wrote:

> You can obtain the working directory with os.getcwd().

Maybe. On Unix, it's possible that the current directory no longer
has a pathname. As with files, directories can be "deleted" (i.e.
unlinked) even while they're still in use.

Similarly, a directory can be renamed while it's in use, so the current
directory's pathname may have changed even while the current directory
itself hasn't.




More information about the Python-list mailing list