Skip to content

Commit

Permalink
make to_file accept simple file name again
Browse files Browse the repository at this point in the history
  • Loading branch information
thehrh committed Sep 5, 2024
1 parent 7753dea commit 94785ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pisa/utils/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,9 @@ def to_file(obj, fname, fmt=None, overwrite=True, warn=True, **kwargs):
ext = fmt.lower()

dirname = os.path.dirname(fname)

os.makedirs(dirname, exist_ok=True)
if dirname != "":
# would fail with FileNotFoundError otherwise
mkdir(dirname, warn=warn)

if ext in ZIP_EXTS or ext in XOR_EXTS:
rootname, inner_ext = os.path.splitext(rootname)
Expand Down

0 comments on commit 94785ca

Please sign in to comment.