strange interaction between open and cwd

Baz Walter bazwal at ftml.net
Mon May 3 12:27:05 EDT 2010


On 03/05/10 15:56, Grant Edwards wrote:
> On 2010-05-03, Baz Walter<bazwal at ftml.net>  wrote:
>> On 03/05/10 14:46, Peter Otten 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?
>>>
>>> My tentative explanation would be that the directory, namely the inode,
>>> still exists -- only the entry for it in its parent directory is gone.
>>>
>>> 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".
>>
>> so "here" must always be available somehow,
>
> Yes.
>
>> even if getcwd() fails
>
> If the current working directory doesn't _have_ a path within a
> filesystem, what do you expect it to do?

well, i expect it to fail, like i said :)

>> (something like the environment variable $PWD). shame that
>> os.getenv('PWD') isn't reliable, as it would solve my issue :(
>
> I don't understand what you mean by that.

i'm trying to understand how the path of the cwd can be known if there 
is no entry for it in the filesytem - but this is starting to get a 
little OT, so i won't pursue it here any longer.






More information about the Python-list mailing list