[Python-Dev] IO module improvements

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri Feb 5 17:46:43 CET 2010

On 03:57 pm, guido at python.org wrote:
>On Fri, Feb 5, 2010 at 5:28 AM, Antoine Pitrou <solipsis at pitrou.net> 
>>Pascal Chambon <pythoniks <at> gmail.com> writes:
>>>By the way, I'm having trouble with the "name" attribute of raw 
>>>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 

    exarkun at boson:~$ python
    Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)    [GCC 4.4.1] on 
    Type "help", "copyright", "credits" or "license" for more 
    >>> import os, io
    >>> f = io.open('.bashrc')
    >>> os.chdir('/')
    >>> f.name
    >>> os.path.abspath(f.name)

More information about the Python-Dev mailing list