mirror of https://github.com/flaggo/pydu.git
Add exit_ok=True in open file when parent dir is exists
This commit is contained in:
parent
99c9a3f837
commit
1c7f5ed830
|
@ -72,7 +72,7 @@ def open_file(path, mode='wb+', buffer_size=-1, ignore_errors=False):
|
||||||
f = None
|
f = None
|
||||||
try:
|
try:
|
||||||
if path and not os.path.isdir(path):
|
if path and not os.path.isdir(path):
|
||||||
makedirs(os.path.dirname(path))
|
makedirs(os.path.dirname(path), exist_ok=True)
|
||||||
f = open(path, mode, buffer_size)
|
f = open(path, mode, buffer_size)
|
||||||
except Exception:
|
except Exception:
|
||||||
if not ignore_errors:
|
if not ignore_errors:
|
||||||
|
|
Loading…
Reference in New Issue