python2 compatible

This commit is contained in:
Vostretsov Nikita 2019-07-15 04:00:12 +05:00
parent 56bff528e5
commit ee4539b68d
1 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@
Scheduler queues
"""
import errno
import marshal
import os
import os.path
@ -17,7 +18,10 @@ def _with_mkdir(queue_class):
class DirectoriesCreated(queue_class):
def __init__(self, path, *args, **kwargs):
os.makedirs(os.path.dirname(path), exist_ok=True)
dirname = os.path.dirname(path)
if not os.path.exists(dirname):
os.makedirs(dirname)
super(DirectoriesCreated, self).__init__(path, *args, **kwargs)
return DirectoriesCreated