This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pronovic
Recipients
Date 2006-05-26.21:28:16
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 14:40:16adminlinkissue1495754 messages
2007-08-23 14:40:16admincreate