os.listdir() bug in WinXp. Calling with empty string

Gerrit Holl gerrit at nl.linux.org
Sat Oct 4 11:44:12 EDT 2003


<quote name="Hannu Kankaanp??" date="1065252981" email="hanzspam at yahoo.com.au">
> This may be a bug or simply a strange result of undefined
> behaviour, but this is what I get with Python 2.3.2 on
> Windows XP:
> 
> >>> import os
> >>> os.listdir('')
> [ filenames in the current directory, e.g. c:\python\ ]
> >>> os.listdir(u'')
> [ filenames in the drive's root directory, e.g. c:\ ]

Output on Redhat Linux 9.0:

17:43:19:2:gerrit at topjaklont:~/email/2003/39$ python
Python 2.3 (#1, Aug  5 2003, 14:13:25)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
  0 >>> import os
  1 >>> os.listdir('')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 2] No such file or directory: ''
  2 >>> os.listdir(u'')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
OSError: [Errno 2] No such file or directory: ''

Gerrit.

- 
Mozilla _is_ the web: it grows faster than you can download it.
1011001 1101111 1110101 1110010 1110011 0101100
1000111 1100101 1110010 1110010 1101001 1110100





More information about the Python-list mailing list