os.path.isdir do not work for Foder named '2011-07-03'

Rob Williscroft rtw at rtw.me.uk
Tue Jul 19 00:56:59 EDT 2011


Nulpum wrote in news:0bf400a3-735c-487a-8d74-
feb3b56be99b at g5g2000prn.googlegroups.com in gmane.comp.python.general:

> I want to make sure that folder exists.
> '2011-07-03' is really exists. but 'os.path.isdir' say false
> Does anyone know why?
> 
>>>> os.path.isdir("C:\Users\Á¶Ã¢ÁØ\Desktop\logs")
> True
>>>> os.path.isdir("C:\Users\Á¶Ã¢ÁØ\Desktop\logs\2011-07-03")
> False

Maybe it isn't a directory, but a file, what does os.path.exists() return.

Also could it be a "Shortcut" in which case 2011-07-03.lnk will exist.

Also have you left "Hide extensions for known file types" switched on,
in which case it may really be "2011-07-03.zip" for example, a file 
not a directory even though Windows explorer shows it as a directory.

-- 
Rob.




More information about the Python-list mailing list