-
Notifications
You must be signed in to change notification settings - Fork 26
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
[Bug]: Inheriting from subclass of DynamicTable triggers attribute error #948
Comments
Could you clarify that the error comes up only when running inspector and not when writing the file or using any of the containers in question @dysprague |
What is your timeline in terms of pushing the extension? I should have some time next week to take a look! @dysprague |
The error only comes up when running inspector. I was reading and writing and using these files with behavior as expected and only triggered this issue when running the NWB inspector. I'm not in a huge rush but hoping to publish in the next two weeks or so if you could take a look this week that would be great! Thanks! |
@CodyCBakerPhD I just wanted to reach since this issue seems like it might be related to nwb-inspector. Is there maybe just a different way in which to call the inspector since this involves extensions? |
I think this is in part because in your example you are defining and registering a custom class for |
@oruebel Let me see if I understand. |
I assume the extension is not actually installed and imported when running the nwb-inspector. I.e., the inspector needs to load the schema for the extension from the file, and since there is no Container for |
@dysprague can you provide a link to your extension and I'll take a look. |
The inspector didn't have an issue with the BEADL extension. I'll try running inspector with the extension and see. |
@mavaylon1 Providing the link to the extension here. |
I used PlaneExtension in the original comment to recreate the error in the most basic way, but the object that is actually triggering the error in my workflow is the VolumeSegmentation object |
Just checking in on if there has been any progress on this. Let me know if you need anything else from me. |
@dysprague Taking a look today! I'll keep you posted. |
@dysprague I don't see the spec for your PlaneExtension in the repo. Do you have it there and I am missing something? |
@dysprague have you |
@dysprague Any word on the spec? |
@mavaylon1 Sorry, I was out of office Thursday and Friday and just saw this! I have The object that is triggering the error in my extension is the VolumeSegmentation object which inherits from the PlaneSegmentation object. I wrote the PlaneExtension object here to show the minimal case that creates the error, but VolumeSegmentation triggers that exact same error. |
Hey @dysprague I am having trouble actually reproducing your error. These are the versions I am using and the steps I did. Let's see if we can get to the same output.
Try this in a new environment and check your versions. It is similar to your code that you have but I commented out the register_class for PlaneExtension |
@rly Can you also follow those steps? It seems to write the nwbfile just fine. I run the inspector as well and have no issues. Granted, I ran it without Dandi settings. @dysprague can you run the inspector as follows: |
@mavaylon1 if the extension is installed with |
@oruebel The extension does not define a PlaneSegmentation class. It imports it from pynwb. |
Sorry, I meant the |
@mavaylon1 Confirming that when I run the code that you provide, this error is not triggered. This is both with and without the dandi config flag. https://github.com/focolab/ndx-multichannel-volume/tree/test I just added the PlaneExtension class to the schema in a new git branch of the extension. When I register class in the ndx-multichannel-volume.py file and then otherwise run all of the same code as the previous test when the class was just defined but not registered, I am still triggering the same error as I described initially. Used the code below to generate the file after pip install . from the test branch of the extension.
Then run nwbinspector . Error should trigger regardless of whether you use the --config dandi flag. |
Hi @dysprague we found the issue and are working on a fix: #959 |
What happened?
I am working on an extension of Pynwb and one object that I am creating is an extension of the Pynwb PlaneSegmentation object. I was able to write and read NWB files created with this extended object, but when I tried to run the NWBinspector to verify the NWB file I got an error "AttributeError: type object 'MultiContainerInterface' has no attribute 'columns'".
After doing some careful tracing of the error, it appears that the error is being caused because the hdmf/build/classgenerator.py file is adding the MultiContainerInterface CustomGenerator to the end of bases in line 70, so when hdmf/utils/ExtenderMeta tries to call the DynamicTable function '__gather_colums' in hdmf/common/table.py line 280, it ends up trying to add columns from the MultiContainerInterface object rather than the PlaneSegmentation object which actually has the columns attribute.
I was able to recreate this error with a very simple extension of the PlaneSegmentation object which basically just inherits all of the same methods and variables without any changes.
I was able to avoid this error by adding an elif after line 380 in hdmf/build/classgenerator.py which checks whether bases[0] is a subclass of Container. However, when I do this I get further errors that DynamicTable is empty, so I think there may be some cascading issues.
I am trying to publish this extension and get other labs using it very soon so I would appreciate if someone could look at this soon!
Steps to Reproduce
Traceback
Operating System
macOS
Python Executable
Conda
Python Version
3.11
Package Versions
environment_for_issue.txt
Code of Conduct
The text was updated successfully, but these errors were encountered: