best way to check if a file exists?

Fredrik Lundh fredrik at pythonware.com
Thu Nov 2 08:27:41 EST 2006


Steven D'Aprano wrote:

> But there can be a race condition between os.path.exists returning True
> and you trying to open the file, if some other process deletes or renames
> the file in the meantime.

if you'd used a threaded newsreader, you would have seen the code that 
"as follows" was referring to, and you would probably also have noticed 
that people have been pointing out the potential race problems several 
times already.

</F>




More information about the Python-list mailing list