[issue26655] pathlib glob case sensitivity issue on Windows
Udo Eberhardt added the comment: Meanwhile I realized this problem as well. There is no easy solution to determine exact spelling of the entire path. So it seems there is no simple solution to my problem. The concept of treating file system paths case-insensitive (as Windows does) seems to be a bad idea. -- ___ Python tracker <http://bugs.python.org/issue26655> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26655] pathlib glob case sensitivity issue on Windows
Udo Eberhardt added the comment: So this is a trade-off between consistent behavior and efficiency. My point of view is that glob is for enumerating matching files and it should consistently return the real file names. Typically glob will be called with a pattern like '*.txt' and it will have to iterate names anyway, right? In the special case that it is called with a literal name it could do the same to produce consistent results. A user who wants to check (more efficiently) if a literal name exists, can use Path.exists(). The statement in the doc could be: Note: To find the literal names in the file system, glob always enumerates files and directories. To check more efficiently whether a specific file exists, use exists(). -- ___ Python tracker <http://bugs.python.org/issue26655> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26655] pathlib glob case sensitivity issue on Windows
New submission from Udo Eberhardt: On Windows Path.glob does not always return the file name with correct case. If the current directory contains a file named MixedCase.txt then the following script: import pathlib p = pathlib.Path('.') print(list(p.glob('*.txt'))) print(list(p.glob('Mixedcase.txt'))) yields: [WindowsPath('MixedCase.txt')] [WindowsPath('mixedcase.txt')] Problem: The result of the second call to glob should be 'MixedCase.txt' as well. I would expect that glob returns a file name exactly as it is spelled in the file system. -- components: Library (Lib), Windows messages: 262570 nosy: paul.moore, steve.dower, tim.golden, udo.eberhardt, zach.ware priority: normal severity: normal status: open title: pathlib glob case sensitivity issue on Windows type: behavior versions: Python 3.5 ___ Python tracker <http://bugs.python.org/issue26655> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com