How to avoid “WindowsError: [Error 5] Access is denied”

后端 未结 7 1787
遥遥无期
遥遥无期 2020-12-06 05:12

There\'s the script to re-create folder:

# Remove folder (if exists) with all files
if os.path.isdir(str(os.path.realpath(\'..\') + \"\\\\my_folder\")):
             


        
7条回答
  •  眼角桃花
    2020-12-06 05:16

    For me it worked in this way:

    while os.path.isdir (your_path):
        shutil.rmtree (your_path, ignore_errors=True)
    os.makedirs (your_path)
    

提交回复
热议问题