classification
Title: glob.glob inconsistent
Type: behavior Stage: test needed
Components: Library (Lib), Windows Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, amaury.forgeotdarc, eric.araujo, kveretennicov, norbidur
Priority: normal Keywords: patch

Created on 2007-08-18 00:14 by norbidur, last changed 2010-09-27 20:39 by kveretennicov.

Files
File name Uploaded Description Edit
glob_preserve_sep.patch amaury.forgeotdarc, 2010-07-31 13:11 review
Messages (5)
msg32653 - (view) Author: norbidur (norbidur) Date: 2007-08-18 00:14
On windows, glob.glob gives different results if you use a wildcard or not and if you use unix-style paths.

exemple : 
import glob
print glob.glob("c:/tmp/3691674.jpg")
print glob.glob("c:/tmp/3691674.jpg*")
print glob.glob("c:/res.txt")
print glob.glob("c:/res.txt*")

gives :
['c:/tmp/3691674.jpg']
['c:/tmp\\3691674.jpg']
['c:/res.txt']
['c:/res.txt']


the two first calls give the same result but one with a platform specific separator, and not the other.
One can think that if there is no wildcard, this is normal behavior to return the path given to glob.glob but then I have the second inconsitency : in that case the last result should be c:\\res.txt.
msg108627 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-06-25 20:30
Hardly a show stopper. It's actually a problem(?) with ntpath.py.  It could be patched but is it worth it, as this would be yet more work for you guys doing the build/release process?  I'd close this on the grounds that it's not worth the effort.
msg111727 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-07-27 20:38
As no response to msg108627 I'll close this unless there are any objections.
msg111728 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-07-27 20:45
Some bugs take a long time to get fixed. I agree that three years is not a good score, but this really needs a test in order to get closed or fixed, so I’m reopening. Maybe the OP or you could add a test? :)
msg112151 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-07-31 13:11
Here is a test + patch, to preserve the separator. Of course this changes the current behaviour, like:
>>> glob.glob('/tmp/////foo*')
['/tmp/////foo1', '/tmp/////foo2']
History
Date User Action Args
2010-09-27 20:39:02kveretennicovsetnosy: + kveretennicov
2010-07-31 13:11:51amaury.forgeotdarcsetfiles: + glob_preserve_sep.patch

nosy: + amaury.forgeotdarc
messages: + msg112151

keywords: + patch
2010-07-27 20:45:18eric.araujosetstatus: pending -> open
versions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6
nosy: + eric.araujo

messages: + msg111728
2010-07-27 20:38:06BreamoreBoysetstatus: open -> pending

messages: + msg111727
2010-06-25 20:30:00BreamoreBoysetnosy: + BreamoreBoy
messages: + msg108627
2009-04-07 04:04:06ajaksu2setstage: test needed
type: behavior
components: + Windows
versions: + Python 2.6, - Python 2.5
2007-08-18 00:14:50norbidurcreate