Python “FileExists” error when making directory February 1, 2023 by Tarik As of Python >=3.2, os.makedirs() can take a third optional argument exist_ok: os.makedirs(mydir, exist_ok=True)