summaryrefslogtreecommitdiff
path: root/pokemontools/helpers.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-09-01 16:04:50 -0500
committerBryan Bishop <kanzure@gmail.com>2013-09-01 16:04:50 -0500
commit5507494a350bd602d47dd69bd2bde90a3de43590 (patch)
tree2f604610616063b28a83327ba5a49b5b827bb6bc /pokemontools/helpers.py
parentabd5264a9db65c55c230aed0aeeb0805f7204680 (diff)
move mkdir_p out of gfx.py and into helpers.py
It seems that mkdir_p is unused at the moment.
Diffstat (limited to 'pokemontools/helpers.py')
-rw-r--r--pokemontools/helpers.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pokemontools/helpers.py b/pokemontools/helpers.py
index 42cec87..17e7a74 100644
--- a/pokemontools/helpers.py
+++ b/pokemontools/helpers.py
@@ -1,6 +1,7 @@
"""
Generic functions that should be reusable anywhere in pokemontools.
"""
+import os
def index(seq, f):
"""return the index of the first item in seq
@@ -27,3 +28,14 @@ def flattener(x):
def flatten(x):
"flattens a list of sublists into just one list"
return list(flattener(x))
+
+def mkdir_p(path):
+ """
+ Make a directory at a given path.
+ """
+ try:
+ os.makedirs(path)
+ except OSError as exc: # Python >2.5
+ if exc.errno == errno.EEXIST:
+ pass
+ else: raise