strange interaction between open and cwd
Baz Walter
bazwal at ftml.net
Mon May 3 10:10:21 EDT 2010
On 03/05/10 14:56, Chris Rebert wrote:
>> but how does '..' get resolved in the relative path '../abc.txt'? i'm
>> assuming python must initially use getcwd() internally to do this, and then
>> if that fails it falls back on something else. but what is that something
>> else? is it something that is reproducible in pure python?
>
> I would think that the OS system call, not Python itself, does the
> relative->absolute conversion.
so there is a discrepancy between some of the std library path functions
(like realpath, getcwd, abspath) and the built-in open function. there
are files which can be opened for which it is impossible to resolve
their full paths (on some platforms).
More information about the Python-list
mailing list