Race condition when creating directories in BaseDirectory.py
If two processes are trying to get the same resource from
BaseDirectory.py, a race condition can occur where
os.makedirs(path) fails because another process created the directory in the meantime. @twpayne has already created a PR to fix it, but hasn't received a response from any maintainers or owners. It's possible this is because his solution doesn't support Python 2.7, so I've proposed a 2.7-capable version (as well as a version that works in 3.4+).