diff --git a/ox/cache.py b/ox/cache.py index 05830f1..882700a 100644 --- a/ox/cache.py +++ b/ox/cache.py @@ -121,7 +121,7 @@ get_url=read_url def save_url(url, filename, overwrite=False): if not os.path.exists(filename) or overwrite: dirname = os.path.dirname(filename) - if not os.path.exists(dirname): + if dirname and not os.path.exists(dirname): os.makedirs(dirname) data = read_url(url) with open(filename, 'wb') as f: diff --git a/ox/net.py b/ox/net.py index 8706247..200a2b4 100644 --- a/ox/net.py +++ b/ox/net.py @@ -113,7 +113,7 @@ get_url=read_url def save_url(url, filename, overwrite=False): if not os.path.exists(filename) or overwrite: dirname = os.path.dirname(filename) - if not os.path.exists(dirname): + if dirname and not os.path.exists(dirname): os.makedirs(dirname) data = read_url(url) with open(filename, 'wb') as f: