Why doesn't Python remember the initial directory?

Neil Hodgson nhodgson at iinet.net.au
Tue Aug 21 03:39:19 CEST 2012


> Maybe. On Unix, it's possible that the current directory no longer
> has a pathname.

    Its also possible that you do not have permission to successfully 
call getcwd. One example of this I have experienced is the OS X sandbox 
where you can run Python starting in a directory where you have only 
limited permissions.

    getcwd works by calling readdir and lstat and looping up from the 
current directory to the root to build the whole path so will break 
without read permissions on directories:


More information about the Python-list mailing list