mirror of
https://github.com/clearml/clearml
synced 2025-06-26 18:16:07 +00:00
Fix FileLock create target folder
This commit is contained in:
parent
2509756ea8
commit
b6be5da363
@ -197,6 +197,11 @@ class Lock(object):
|
|||||||
|
|
||||||
def _get_fh(self):
|
def _get_fh(self):
|
||||||
'''Get a new filehandle'''
|
'''Get a new filehandle'''
|
||||||
|
# Create the parent directory if it doesn't exist
|
||||||
|
path, name = os.path.split(self.filename)
|
||||||
|
if path and not os.path.isdir(path): # pragma: no cover
|
||||||
|
os.makedirs(path, exist_ok=True)
|
||||||
|
|
||||||
return open(self.filename, self.mode, **self.file_open_kwargs)
|
return open(self.filename, self.mode, **self.file_open_kwargs)
|
||||||
|
|
||||||
def _get_lock(self, fh):
|
def _get_lock(self, fh):
|
||||||
|
Loading…
Reference in New Issue
Block a user