Aiven-Open / Aiven-Open/metadata-parser

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

未关闭
#29 0 条评论 0 个 reaction 已指派 1 人 已被 @TibsAtWork 认领 在 GitHub 查看
bug
主要语言
Python
星标
14
派生
7
PR 合并指标
30 天内没有已合并 PR

描述

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
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 " 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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。