-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ndx-pose fails to write properly when inside a contextmanager #36
Comments
Hi @pauladkisson , thanks for the reproducible example - that helped me trace what is going on. When you call I would recommend either:
There are other ways to manually load the namespace from the YAML file in the installed ndx_pose package on the user's computer, or to update the IO object with the ndx-pose namespace that was added to the global namespace, but those that feel quite hacky. 1 or 2 above seem better, but I do not understand your full use case. |
Thank you for explaining what's going on here. These details are very helpful. I would love to do (1), but |
We could add a function in ndx-pose and all new extensions called We could add a function in pynwb that updates an IO object (or type map) with the latest global namespace. You could call this before write. Users would still need to know that they need to do this. What do you think (out of these or other ideas) would work best for your use case? |
I think this would be the best option. |
@pauladkisson @rly thanks for figuring this out and the detailed explanation. @rly shouldn't there be a way to throw an error when io is writing and encounters an unknown data type? I think the most concerning part of this is the silent error. Throwing an informative error should be a priority here I think. Is that possible or any technical blockers on this? |
@h-mayorquin I agree - a silent error is bad. I'll create an issue ticket on HDMF. |
Related to catalystneuro/neuroconv#1114
Tracked this down to a minimal example with a contextmanager like neuroconv's
make_or_load_nwbfile
. Basically when the io is created in the first part of a context manager (before the yield) but used to write in the second part (after the yield), it doesn't write properly. This can be solved by changing the import location (ex. addingimport ndx_pose
at the top of the script would do it) or changing the io instantiation location (ex. movingio = NWBHDF5IO(nwbfile_path, "w")
inside the finally block would do it).Not sure if ndx_pose needs to fix this or if it's a deeper problem, but would love a thorough explanation to improve my understanding.
Minimal Example:
The text was updated successfully, but these errors were encountered: