OS.MKDIR( ) Overwriting previous folder created...

Florian Diesch diesch at spamfence.net
Sat Feb 4 13:26:32 EST 2006


Ernesto <erniedude at gmail.com> wrote:
> NEVERMIND !  Here is the solution...
>
> # ----------------------------------------------------------------
> if (os.path.isdir("C:\\MyNewFolder") == 0):
> 	os.mkdir("C:\\MyNewFolder")
> # -----------------------------------------------------------------

Maybe some other process creates C:\\MyNewFolder between the call of
isdir and mkdir, or mkdir fails for some other reasons (e.g. no
permission), so you have to catch exceptions anyway. But then there's no
need for isdir.


   Florian
-- 
Das ist ja das positive am usenet: man erfährt oft Dinge, nach denen
gar nicht gefragt wurde.
[Konrad Wilhelm in <lsght1hho14bbe7in8q9currhtc7vuqfru at 4ax.com>]



More information about the Python-list mailing list