Repository navigation
Open
Description
| BPO | 1776674 |
|---|---|
| Nosy | @amauryfa, @ezio-melotti, @merwok, @serhiy-storchaka |
| Files |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = None
created_at = <Date 2007-08-18.00:14:50.000>
labels = ['type-bug', 'library']
title = 'glob.glob inconsistent'
updated_at = <Date 2015-02-09.17:40:03.988>
user = 'https://bugs.python.org/norbidur'bugs.python.org fields:
activity = <Date 2015-02-09.17:40:03.988>
actor = 'serhiy.storchaka'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2007-08-18.00:14:50.000>
creator = 'norbidur'
dependencies = []
files = ['18284']
hgrepos = []
issue_num = 1776674
keywords = ['patch']
message_count = 10.0
messages = ['32653', '108627', '111727', '111728', '112151', '172970', '172972', '172974', '208324', '235622']
nosy_count = 6.0
nosy_names = ['amaury.forgeotdarc', 'norbidur', 'kveretennicov', 'ezio.melotti', 'eric.araujo', 'serhiy.storchaka']
pr_nums = []
priority = 'low'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue1776674'
versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']Linked PRs
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Activity
norbidur commentedon Aug 18, 2007
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.
BreamoreBoy commentedon Jun 25, 2010
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.
BreamoreBoy commentedon Jul 27, 2010
As no response to msg108627 I'll close this unless there are any objections.
merwok commentedon Jul 27, 2010
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? :)
amauryfa commentedon Jul 31, 2010
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']serhiy-storchaka commentedon Oct 15, 2012
The question is what result desirable for glob.glob("c:/tmp///3691674.jpg*"), ['c:/tmp///3691674.jpg'] or ['c:\\tmp\\3691674.jpg']?
serhiy-storchaka commentedon Oct 15, 2012
I have added some comments in Rietveld.
serhiy-storchaka commentedon Oct 15, 2012
Shell preserves the separators. Well, in any case we always can apply os.path.normpath() to result.
serhiy-storchaka commentedon Jan 17, 2014
Amaury, could you provide corrected patch?
serhiy-storchaka commentedon Feb 9, 2015
Ping.