Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 440 Bytes

File metadata and controls

34 lines (21 loc) · 440 Bytes

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