You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Awesome project! I ran into an issue where I was pulling in a diagram off of a drawio file and attempting to update the node. Here is the code I am using:
~\Anaconda3\lib\site-packages\N2G\plugins\diagrams\N2G_DrawIO.py in update_node(self, id, label, data, url, style, width, height, **kwargs)
247 data = data or {}
248 node_data = {}
--> 249 node = self.current_root.find("./object[@id='{}']".format(id))
250 # update data and url attributes
251 node_data.update(data)
AttributeError: 'NoneType' object has no attribute 'find'
I've confirmed the node ID is accurate and that it is loading in the correct template successfully. I looked at the xml and confirmed the ID there as well, no luck. Any idea what is going on here?
The text was updated successfully, but these errors were encountered:
Draw.io uses a newer xml hierarchy where the contains the ID and value/label instead of the older format where preceded . This N2G library is looking for the "object" to identify the node and update the applicable values.
After I corrected for this in my diagrams, I noticed that it would still not update the nodes unless I made sure to turn off compression in File>Properties.
I need to look into elementtree and xml a bit more to correct the code, but it wasn't too difficult for my use case to just update the xml with the object tags.
Uh oh!
There was an error while loading. Please reload this page.
Awesome project! I ran into an issue where I was pulling in a diagram off of a drawio file and attempting to update the node. Here is the code I am using:
diagram = drawio_diagram()
diagram.from_file("test.drawio")
diagram.update_node(id="node-1", label="Update Test")
diagram.dump_file(filename="Sample_graph.drawio", folder="./")
But when it gets to updating the node I receive the following error:
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_xxx\xxx.py in
3 diagram.from_file("test.drawio")
4
----> 5 diagram.update_node(id="node-1", label="Update Test")
6
7 diagram.dump_file(filename="Sample_graph.drawio", folder="./")
~\Anaconda3\lib\site-packages\N2G\plugins\diagrams\N2G_DrawIO.py in update_node(self, id, label, data, url, style, width, height, **kwargs)
247 data = data or {}
248 node_data = {}
--> 249 node = self.current_root.find("./object[@id='{}']".format(id))
250 # update data and url attributes
251 node_data.update(data)
AttributeError: 'NoneType' object has no attribute 'find'
I've confirmed the node ID is accurate and that it is loading in the correct template successfully. I looked at the xml and confirmed the ID there as well, no luck. Any idea what is going on here?
The text was updated successfully, but these errors were encountered: