Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: Why does os.getcwd() sometimes crash with OSError?

Tags:

python

I have this program that at one point accesses os.getcwd(), but some times, depending on where the program has gone before getting to that line, it crashes with the message "OSError: [Errno 2] No such file or directory". I cannot figure out what i can do wrong then calling os.getcwd(). There's no arguments, and there should always be a current working directory, right?

like image 810
Eskil Avatar asked Jul 09 '10 08:07

Eskil


1 Answers

The current directory may have been deleted by another process.

like image 159
Marco Mariani Avatar answered Sep 22 '22 08:09

Marco Mariani