Closed troselab-setup closed 3 weeks ago
I see this has been raised already here: https://github.com/datajoint/datajoint-python/issues/1065#issue-1444879799
I would describe this issue as 'networkx rejects dj.Diagrams with attribute mapping'
Hi! Is there an update to this?
fixing this week :-)
Can reproduce with tests/test_erd.py
on b755c84e in a Dev Container running Python 3.11:
```
vscode ➜ /workspaces/datajoint-python (master) $ pytest tests/test_erd.py
========================================================= test session starts ==========================================================
platform linux -- Python 3.11.4, pytest-8.2.2, pluggy-1.5.0
rootdir: /workspaces/datajoint-python
plugins: Faker-28.4.1, cov-5.0.0
collected 7 items
tests/test_erd.py ....FF. [100%]
=============================================================== FAILURES ===============================================================
____________________________________________________________ test_repr_svg _____________________________________________________________
schema_adv = Schema `djtest_advanced`
def test_repr_svg(schema_adv):
erd = dj.ERD(schema_adv, context=dict())
> svg = erd._repr_svg_()
tests/test_erd.py:53:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
datajoint/diagram.py:440: in _repr_svg_
return self.make_svg()._repr_svg_()
datajoint/diagram.py:428: in make_svg
return SVG(self.make_dot().create_svg())
datajoint/diagram.py:371: in make_dot
dot = nx.drawing.nx_pydot.to_pydot(graph)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
N =
Duplicates #1065
Hi all, has there been a change to dj.Diagram? I updated to dj 14.1 and now I am receiving this error:
`--------------------------------------------------------------------------- ValueError Traceback (most recent call last) File ~/miniconda3/envs/datajoint/lib/python3.8/site-packages/IPython/core/formatters.py:343, in BaseFormatter.call(self, obj) 341 method = get_real_method(obj, self.print_method) 342 if method is not None: --> 343 return method() 344 return None 345 else:
File ~/miniconda3/envs/datajoint/lib/python3.8/site-packages/datajoint/diagram.py:436, in Diagram._reprsvg(self) 435 def _reprsvg(self): --> 436 return self.make_svg()._reprsvg()
File ~/miniconda3/envs/datajoint/lib/python3.8/site-packages/datajoint/diagram.py:424, in Diagram.make_svg(self) 421 def make_svg(self): 422 from IPython.display import SVG --> 424 return SVG(self.make_dot().create_svg())
File ~/miniconda3/envs/datajoint/lib/python3.8/site-packages/datajoint/diagram.py:371, in Diagram.make_dot(self) 308 label_props = { # http://matplotlib.org/examples/color/named_colors.html 309 None: dict( 310 shape="circle", (...) 364 ), 365 } 366 node_props = { 367 node: label_props[d["node_type"]] 368 for node, d in dict(graph.nodes(data=True)).items() 369 } --> 371 dot = nx.drawing.nx_pydot.to_pydot(graph) 372 for node in dot.get_nodes(): 373 node.set_shape("circle")
File ~/miniconda3/envs/datajoint/lib/python3.8/site-packages/networkx/drawing/nx_pydot.py:309, in to_pydot(N) 298 raise_error = ( 299 _check_colon_quotes(u) 300 or _check_colon_quotes(v) (...) 306 ) 307 ) 308 if raise_error: --> 309 raise ValueError( 310 f'Node names and attributes should not contain ":" unless they are quoted with "".\ 311 For example the string \'attribute:data1\' should be written as \'"attribute:data1"\'.\ 312 Please refer https://github.com/pydot/pydot/issues/258' 313 ) 314 edge = pydot.Edge(u, v, **str_edgedata) 315 P.add_edge(edge)
ValueError: Node names and attributes should not contain ":" unless they are quoted with "". For example the string 'attribute:data1' should be written as '"attribute:data1"'. Please refer https://github.com/pydot/pydot/issues/258`
Reproducibility
Include: