8000 Allow pathlib.Path arguments, from issue #6418 by r0fls · Pull Request #6655 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Allow pathlib.Path arguments, from issue #6418 #6655

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
initial implementation of posix path support for _savez method
  • Loading branch information
r0fls committed Nov 8, 2015
commit ccc830e0dd0596477393cb2dfd3e41e9299f76f3
9 changes: 9 additions & 0 deletions numpy/lib/npyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,19 @@ def _savez(file, args, kwds, compress, allow_pickle=True, pickle_kwargs=None):
import zipfile
# Import deferred for startup time improvement
import tempfile
try:
from pathlib import Path
supports_pathlib = True
except:
supports_pathlib = False

if isinstance(file, basestring):
if not file.endswith('.npz'):
file = file + '.npz'
elif supports_pathlib:
if isinstance(file,Path):
file = file.__str__()
import pdb; pdb.set_trace()

namedict = kwds
for i, val in enumerate(args):
Expand Down
0