Skip to content

Commit

Permalink
making missing directories if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Feb 16, 2016
1 parent 49b4474 commit e7871c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions portalocker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def open_atomic(filename, binary=True):
'''
assert not os.path.exists(filename), '%r exists' % filename
path, name = os.path.split(filename)

# Create the parent directory if it doesn't exist
if path and not os.path.isdir(path): # pragma: no cover
os.makedirs(path)

temp_fh = tempfile.NamedTemporaryFile(
mode=binary and 'wb' or 'w',
dir=path,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__package_name__ = 'portalocker'
__author__ = 'Rick van Hattem'
__email__ = 'wolph@wol.ph'
__version__ = '0.5.6'
__version__ = '0.5.7'
__description__ = '''Wraps the portalocker recipe for easy usage'''
__url__ = 'https://github.com/WoLpH/portalocker'

Expand Down

0 comments on commit e7871c2

Please sign in to comment.