Very often in the Windows 7 console if I run a python program twice very quickly that does
if os.path.isdir(d):
shutil.rmtree(d)
if not os.path.exists(d):
os.mkdir(d)
where d
is the name of a directory with many files, I get a "Permission denied" for the mkdir
command. But if I run once, then wait some seconds, then run again I do not get such error.
What is the problem here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…