Bug in glob.glob for files w/o extentions in Windows

Duncan Booth duncan at NOSPAMrcp.co.uk
Mon Dec 1 04:22:29 EST 2003


"Tim Peters" <tim.one at comcast.net> wrote in
news:mailman.1194.1070165783.702.python-list at python.org: 

> ?  Nope.  It's dir that special-cases the snot out of a period, not
> Python's glob.  

On that basis Python also 'special-cases the snot out of a period': try 
win32api.FindFiles('*.') to get the same behaviour as dir.

More accurate would be to say that the operating system has consistent but 
weird behaviour, since it is below the application level that trailing dots 
are stripped from filenames and ignored from file patterns. The only way to 
avoid it on Windows is to retrieve all the filenames and then perform your 
own pattern matching on them.

glob.glob is bypassing the operating system's filename matching to provide 
behaviour which is consistent across different operating systems, but 
inevitably this means that it doesn't match some platform's standard 
behaviour.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?




More information about the Python-list mailing list