[ python-Bugs-1495754 ] os.listdir(): inconsistent behavior with trailing spaces
SourceForge.net
noreply at sourceforge.net
Fri May 26 23:28:17 CEST 2006
Bugs item #1495754, was opened at 2006-05-26 16:28
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1495754&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Kenneth J. Pronovici (pronovic)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.listdir(): inconsistent behavior with trailing spaces
Initial Comment:
I've noticed some inconsistent behavior around
os.listdir() and paths that contain trailing spaces on
the Windows platform.
Take this example code:
import os
import tempfile
tmpdir = tempfile.mkdtemp()
newdir = os.path.join(tmpdir, " collect dir ")
os.mkdir(newdir)
print os.path.exists(newdir)
print os.listdir(newdir)
If I run this code on Windows 2000 Pro using Python
2.4.2, I get this:
True
[Errno 3] The system cannot find the path
specified: 'c:\\docume~1\\a0clu0~1.bcb\\locals~1
\\temp\\tmpfd7j3t\\ collect dir /*.*'
It seems to me that if os.path.exists() tells me that
a file or directory exists, that os.listdir() should
be able to operate on it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1495754&group_id=5470
More information about the Python-bugs-list
mailing list