On Fri, Feb 5, 2010 at 8:46 AM,  <[email protected]> wrote:
> On 03:57 pm, [email protected] wrote:
>>
>> On Fri, Feb 5, 2010 at 5:28 AM, Antoine Pitrou <[email protected]>
>> wrote:
>>>
>>> Pascal Chambon <pythoniks <at> gmail.com> writes:
>>>>
>>>> By the way, I'm having trouble with the "name" attribute of raw files,
>>>> which can be string or integer (confusing), ambiguous if containing a
>>>> relative path,
>>
>> Why is it ambiguous? It sounds like you're using str() of the name and
>> then can't tell whether the file is named e.g. '1' or whether it
>> refers to file descriptor 1 (i.e. sys.stdout).
>
> I think string/integer and ambiguity were different points.  Here's the
> ambiguity:
>
>   exar...@boson:~$ python
>   Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)    [GCC 4.4.1] on linux2
>   Type "help", "copyright", "credits" or "license" for more information.
>   >>> import os, io
>   >>> f = io.open('.bashrc')
>   >>> os.chdir('/')
>   >>> f.name
>   '.bashrc'
>   >>> os.path.abspath(f.name)
>   '/.bashrc'
>   >>>
> Jean-Paul

You're right, I didn't see the OP's comma. :-)

I don't think this can be helped though -- I really don't want open()
to be slowed down or complicated by an attempt to do path
manipulation. If this matters to the app author they should use
os.path.abspath() or os.path.realpath() or whatever before calling
open().

-- 
--Guido van Rossum (python.org/~guido)
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to