Custom node attributes are not persistent
Posted: Fri Aug 04, 2017 5:49 pm
Hello dear BrainVisa experts!
I am trying to add a new custom attribute to a graph node (using PyAims).
I tried to add the attribute to the dictionary:
node['my_attribute_key'] = some_value
This however, works only while I am in the same session. I.e. later in my code I can successfully access node['my_attribute_key'] and get the correct value.
However after I save the graph with aims writer, and reload it, the node has no more 'my_attribute_key'...
write method does not fail, it prints no error or warning. Sadly, it just ignores my attribute...
The attribute I am trying to add is a result of a long computation, which I will need over and over again. I really have to save it for later use.
I tried to override existing attribute with my calculated value and this worked. This workaround, however, looks too ugly to me, and I prefer not to use it (it proofs, however, that there is no problem with my writing procedure in general).
Any cue how I can save my own attribute (without destroying existing one) would be highly appreciated!
Kind regards,
Ruslana.
I am trying to add a new custom attribute to a graph node (using PyAims).
I tried to add the attribute to the dictionary:
node['my_attribute_key'] = some_value
This however, works only while I am in the same session. I.e. later in my code I can successfully access node['my_attribute_key'] and get the correct value.
However after I save the graph with aims writer, and reload it, the node has no more 'my_attribute_key'...
write method does not fail, it prints no error or warning. Sadly, it just ignores my attribute...
The attribute I am trying to add is a result of a long computation, which I will need over and over again. I really have to save it for later use.
I tried to override existing attribute with my calculated value and this worked. This workaround, however, looks too ugly to me, and I prefer not to use it (it proofs, however, that there is no problem with my writing procedure in general).
Any cue how I can save my own attribute (without destroying existing one) would be highly appreciated!
Kind regards,
Ruslana.