use ox.makedirs

This commit is contained in:
j 2017-08-31 15:49:19 +02:00
parent 32abb6106e
commit 5378970187

View file

@ -141,7 +141,7 @@ def save_url(url, filename, overwrite=False):
if not os.path.exists(filename) or overwrite: if not os.path.exists(filename) or overwrite:
dirname = os.path.dirname(filename) dirname = os.path.dirname(filename)
if dirname and not os.path.exists(dirname): if dirname and not os.path.exists(dirname):
os.makedirs(dirname) makedirs(dirname)
data = read_url(url) data = read_url(url)
with open(filename, 'wb') as f: with open(filename, 'wb') as f:
f.write(data) f.write(data)
@ -178,7 +178,7 @@ class SQLiteCache(Cache):
def __init__(self): def __init__(self):
path = cache_path() path = cache_path()
if not os.path.exists(path): if not os.path.exists(path):
os.makedirs(path) makedirs(path)
self.db = os.path.join(path, "cache.sqlite") self.db = os.path.join(path, "cache.sqlite")
self.create() self.create()