Is this a bug?

Courageous jkraska1 at san.rr.com
Sat May 12 08:07:17 EDT 2001


On Sat, 12 May 2001 13:17:56 +0200, "Alex Martelli" <aleaxit at yahoo.com> wrote:

>"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
>news:8a7L6.1640$Yu6.404853 at newsc.telia.net...
>    ...
>>     http://www.python.org/doc/FAQ.html#6.29
>>
>>     ...
>>
>>     If you're trying to build Windows pathnames, note that all
>>     Windows system calls accept forward slashes too:
>>
>>         f = open("/mydir/file.txt") # works fine!
>
>Hmmm, I wonder if this needs updating -- it's true for what
>Python exposes in builtins, module os, etc, but not for what
>comes in via win32all, I believe... the /-acceptance is in the
>C runtime libraries (generally) and not in the "system calls"
>themselves (Windows APIs).

import os

f = os.listdir("/")
>>> os.listdir("")
['jkraska', 'PM-6', 'Utils', 'Progs', 'ffastun.ffa', 'ffastun.ffl', 'Developer',
'ffastun0.ffx', 'ffastun.ffo', 'IMAGE.IDX', 'IMAGE.DAT', 'IMAGE.BAK', 'pagefile.sys',
'Recycled']
>>> 

I believe that Python treats / as the working volume.

C//






More information about the Python-list mailing list