2 ms·
It's good to point out the race condition. To solve this particular problem in future code more compactly however, note that Python 3.2 (finally) adds an "exis
by makecheck 14y ago
It's good to point out the race condition.
To solve this particular problem in future code more compactly however, note that Python 3.2 (finally) adds an "exist_ok" Boolean keyword parameter to the multi-directory variant, os.makedirs(). In other words, calling os.makedirs("mydir", exist_ok=True) will silently ignore existing directories and only raise if other errors occur.