Sorry, apparently I missed this earlier.    If you want to detect `HDUList` objects you should instead test for that explicitly.  You can also create one from a string using `HDUList.fromstring` but I don't think there's a use-case for that here.  But I wouldn't rely on there being a `read` attribute.