Skip to content

Commit

Permalink
Merge pull request #118 from basnijholt/patch-1
Browse files Browse the repository at this point in the history
make hickle work with pathlib.Path
  • Loading branch information
telegraphic authored Feb 11, 2020
2 parents 6138709 + dee105e commit 66b9500
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion hickle/hickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@
except ImportError:
import pickle

try:
from pathlib import Path
string_like_types = string_types + (Path,)
except ImportError:
# Python 2 does not have pathlib
string_like_types = string_types

import warnings

try:
Expand Down Expand Up @@ -178,7 +185,7 @@ def file_opener(f, mode='r', track_times=True):
filename, mode = f.name, f.mode
f.close()
h5f = h5.File(filename, mode)
elif isinstance(f, string_types):
elif isinstance(f, string_like_types):
filename = f
h5f = h5.File(filename, mode)
elif isinstance(f, (H5FileWrapper, h5._hl.files.File)):
Expand Down

0 comments on commit 66b9500

Please sign in to comment.