Closed sundarjhu closed 2 years ago
a = pyphot.UnitHDF_Library()
creates an empty library in memory. Hence no filters there. (One could make a better error message)
Is this what you want to do?
Sorry about that, I pasted the wrong command into the first line, it should be a = pyphot.get_library()
. I've fixed that in the original post.
I find a weird bug that I did not imagine but makes sense
with lib:
print(lib.hdf) # works fine
for fname in lib.content:
print(lib.hdf) # returns None
Because lib.content
calls again the context of the library, it also closes the file, which is then not reopened.
9a1a88f should fix this. Could you test it on your side?
Thank you very much! I'm using Python 3.9.0, and get_library works with the latest sandbox.py commit.
Closing then
The following code results in an AttributeError:
The reason seems to be that the
hdf
attribute is set to NoneType when instantiating UnitHDF_Library:As a workaround, I've used the following successfully:
I'm probably missing something when instantiating the UnitHDF_Library, please let me know. Thanks!