strange interaction between open and cwd

Grant Edwards invalid at invalid.invalid
Mon May 3 10:22:26 EDT 2010


On 2010-05-03, Peter Otten <__peter__ at web.de> wrote:
> Baz Walter wrote:
>
>> attempting to remove the cwd would produce an error). but how can
>> python determine the parent directory of a directory that no longer
>> exists?

Python doesn't determine the parent directory.  The Unix system call
and filesystem code do.

The same thing happens in bash.  IOW, you can do this:

 $ rm -rf $PWD; cd ..

> My tentative explanation would be that the directory, namely the
> inode, still exists -- only the entry for it in its parent directory
> is gone.

That sounds right.

> So "one level up from here" is still a valid operation, but there is
> no longer a path in the file system associated with "here".

I believe that is the case.

-- 
Grant Edwards               grant.b.edwards        Yow! -- I have seen the
                                  at               FUN --
                              gmail.com            



More information about the Python-list mailing list