[Python-bugs-list] [ python-Bugs-818059 ] os.listdir on empty strings. Inconsistent behaviour.

SourceForge.net noreply at sourceforge.net
Tue Oct 28 01:31:43 EST 2003


Bugs item #818059, was opened at 2003-10-05 05:50
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818059&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Hannu Kankaanpää (hannukoo)
>Assigned to: Just van Rossum (jvr)
Summary: os.listdir on empty strings. Inconsistent behaviour.

Initial Comment:
Behaviour tested in Python 2.3 (final) and 2.3.2 (final).
os.listdir('') and os.listdir(u'') have very different
behaviour across different OSes:

WinXP/WinNT:
os.listdir('') -- current dir (e.g. c:\python)
os.listdir(u'') -- root dir (e.g. c:\)

Win98
os.listdir('') -- root dir
os.listdir(u'') -- root dir

Redhat Linux 9.0
os.listdir('') -- OSError
os.listdir(u'') -- OSError

Particularly weird is the WinXP/WinNT behaviour that is
different between unicode and normal strings.

Suggestion for fix: Make os.listdir for empty strings 
always
raise an exception or always list the current working 
directory.


----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-10-28 01:31

Message:
Logged In: YES 
user_id=80475

Just, I believe this was your change.

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-10-28 01:29

Message:
Logged In: YES 
user_id=80475

Confirmed for WinME/98.  Also, the behavior changed from
Py2.2 where on WinME/98, it returned the root directory.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818059&group_id=5470



More information about the Python-bugs-list mailing list