fhs / pyhdf

Python wrapper around the NCSA HDF version 4 library
https://pypi.org/project/pyhdf/
Other
46 stars 16 forks source link

Support pathlib.Path input #48

Open dstansby opened 3 years ago

dstansby commented 3 years ago

In calls like f = h4.SD(fname), it would be good to accept a pathlib.Path object as well as a string to pass the filename. Currently doing this raises the error:

  File "/Users/dstansby/github/psipy/psipy/io/mas.py", line 10, in read_hdf
    f = h4.SD(fname)
  File "/Users/dstansby/miniconda3/envs/dev/lib/python3.8/site-packages/pyhdf/SD.py", line 1428, in __init__
    id = _C.SDstart(path, mode)
TypeError: in method 'SDstart', argument 1 of type 'char const *'