Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

readme.md

FileExistsError: [Errno 17] File exists

Reproduce

import os

os.mkdir("test_dir")
os.mkdir("test_dir")

Error Message

FileExistsError: [Errno 17] File exists: 'test_dir'

Fix

import os

if not os.path.exists("test_dir"):
    os.mkdir("test_dir")

Reflection

I tried to create something that was already there.

Reference