Skip to content

Instantly share code, notes, and snippets.

@kissgyorgy
Created October 9, 2013 04:19
Show Gist options
  • Save kissgyorgy/6896170 to your computer and use it in GitHub Desktop.
Save kissgyorgy/6896170 to your computer and use it in GitHub Desktop.
Python: Make directory while avoiding race conditions
# http://stackoverflow.com/a/5032238/720077
import os
import errno
def make_sure_path_exists(path):
try:
os.makedirs(path)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment