0

I'm using pyhdf.SD to import some hdf5 files to python. I'm able to import one file in a program

file=SD(file_path,SDC.READ)

But after that, if I import another hdf5 file within the same program, it throws an error HDF4Error: SD: no such file.

I tried to reimport the pyhdf module after importing a hdf5 file, but the error persists.

What might have caused this?

The file I am dealing with cannot be imported through h5py module, so SD method seems to be the only way for now.

Pixel_Bear
  • 97
  • 1
  • 1
  • 11
  • 1
    The message suggest that the file does not exists. Are you sure that the file path is ok? Are you using a relative path? – Gonzalo Odiard Dec 22 '22 at 01:07
  • @GonzaloOdiard I had stored the file paths in a list in this format r"folder\file.hdf", this was creating some problem. It has something to do with string formatting and NOT with SD. Thank you. – Pixel_Bear Dec 22 '22 at 03:28

0 Answers0