简体   繁体   中英

HDF4 Errror: Non-Existent Dataset

Error :

File "C:\\Users\\hp\\Anaconda2\\lib\\site-packages\\pyhdf\\SD.py", line 1623, in select raise HDF4Error("select: non-existent dataset")

HDF4Error: select: non-existent dataset

Why this error is there i am not getting and as i am not a programmer so not getting the point where the problem is defined.

    if isinstance(name_or_index, type(1)):
        idx = name_or_index
    else:
        try:
            idx = self.nametoindex(name_or_index)
        except HDF4Error:
        raise HDF4Error("select: non-existent dataset")
    id = _C.SDselect(self._id, idx)
    _checkErr('select', id, "cannot execute")
    return SDS(self, id)

Be careful with indents(4 character spaces or tab) in python. Python uses indents to identify a block of code instead of any enclosures. Try running this:

if isinstance(name_or_index, type(1)):
    idx = name_or_index
else:
    try:
        idx = self.nametoindex(name_or_index)
    except HDF4Error:
        raise HDF4Error("select: non-existent dataset")
        id = _C.SDselect(self._id, idx)
        _checkErr('select', id, "cannot execute")
        return SDS(self, id)

I just put an indent for except statement. Check if it works :) I corrected all indents too after you said you got error again

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM