Skip to content
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

Dot file writing can fail because of node values with : in them? #29

Open
TibsAtWork opened this issue Jul 18, 2022 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@TibsAtWork
Copy link
Contributor

When working with our internal sandbox project, I have seen occurrences of:

Traceback (most recent call last):
  File "/Users/tony.ibbs/temp/metadata-parser/metadata-parser/main.py", line 79, in <module>
    pyvis_display.pyviz_graphy(nodes, edges)
  File "/Users/tony.ibbs/temp/metadata-parser/metadata-parser/src/pyvis_display.py", line 109, in pyviz_graphy
    write_dot(g, 'graph_data.dot')
  File "/Users/tony.ibbs/temp/metadata-parser/metadata-parser/venv/lib/python3.10/site-packages/networkx/utils/decorators.py", line 845, in func
    return argmap._lazy_compile(__wrapper)(*args, **kwargs)
  File "<class 'networkx.utils.decorators.argmap'> compilation 5", line 5, in argmap_write_dot_1
  File "/Users/tony.ibbs/temp/metadata-parser/metadata-parser/venv/lib/python3.10/site-packages/networkx/drawing/nx_pydot.py", line 51, in write_dot
    P = to_pydot(G)
  File "/Users/tony.ibbs/temp/metadata-parser/metadata-parser/venv/lib/python3.10/site-packages/networkx/drawing/nx_pydot.py", line 263, in to_pydot
    raise ValueError(
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

(line numbers may be a little off as this was on a branch). This causes the program to stop.

  1. If writing the dot file fails, catch the exception
  2. Work out what to escape in the output so that this does not happen
@TibsAtWork TibsAtWork added the bug Something isn't working label Jul 18, 2022
@TibsAtWork TibsAtWork self-assigned this Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant