Skip to content

Commit e35c894

Browse files
committed
FIX: set exist_ok=True in os.makedirs()
1 parent 8783e21 commit e35c894

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sphinx_intl/catalog.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ def dump_po(filename, catalog, **kwargs):
3232
:return: None
3333
"""
3434
dirname = os.path.dirname(filename)
35-
if not os.path.exists(dirname):
36-
os.makedirs(dirname)
35+
os.makedirs(dirname, exist_ok=True)
3736

3837
# (compatibility) line_width was the original argument used to forward
3938
# line width hints into write_po's `width` argument; if provided,
@@ -55,8 +54,8 @@ def write_mo(filename, catalog, **kwargs):
5554
:return: None
5655
"""
5756
dirname = os.path.dirname(filename)
58-
if not os.path.exists(dirname):
59-
os.makedirs(dirname)
57+
os.makedirs(dirname, exist_ok=True)
58+
6059
with open(filename, "wb") as f:
6160
mofile.write_mo(f, catalog, **kwargs)
6261

0 commit comments

Comments
 (0)