python - Graphviz 命令 '['dot', '-Tdot']' 返回非零退出状态 -11
问题描述
我想提取 Graphviz 为我的图表计算的坐标。但是,我在 Python 2.7 和 Graphviz 0.9 中遇到了以下错误:
Graphviz command '['dot', '-Tdot']' returned non-zero exit status -11
我找不到有关这些错误代码的任何文档。下面是我正在使用的代码:
gvz = GraphUtils.toGraphvizGraph(graph)
parsed_dot = gvz.pipe('dot')
第一行将我自己的图形表示转换为 Graphviz Digraph 实例。
result = Digraph()
# By hashing the ids, we get rid of any potential special characters graphviz does not like
# A graphviz ID always needs to start with a character
for node in graph.nodes.to_dict(orient='records'):
result.node('id_{}'.format(abs(hash(node[node_name_key]))), 'label for width')
# END LOOP
for edge in graph.edges.to_dict(orient='records'):
result.edge('id_{}'.format(abs(hash(edge[edge_source_key]))), 'id_{}'.format(abs(hash(edge[edge_target_key])), edge[edge_label_key]))
# END LOOP
return result
第二行将图形转换为 DOT,其中包含我需要的坐标。但是,这是我的错误发生的地方。
在测试时,我发现有时我的节点 ID 会包含非法字符(定义见此处)。我通过将我所有的 id 转换为哈希来消除这些情况。现在我所有的节点 id 看起来像这样:
['id_7598267142946574759', 'id_2914022568081909736', 'id_2112657658742367456', 'id_2416843868423017323']
这消除了我的一些图表的错误,但不是所有图表。由于错误代码仍然相同,我认为这些 id 肯定还是有问题。但是,由于错误代码实际上并未在任何地方定义,我也可能看错了方向。我错过了什么?
解决方案
推荐阅读
- go - 如何分发仅二进制包
- object - 如何操作不和谐对象?
- windows - Windows 批处理文件:for /F 只读 mylist.txt 的第一行,然后删除第一行
- node.js - 如何使用 Handlebars 模板在浏览器中使用 MongoDB 和 Node js 呈现聚合结果?
- reactjs - 如何在 React 中导入整个文件夹?
- ruby-on-rails - Watir 脚本偶尔返回 Net::ReadTimeout 错误
- javascript - Angular 5 在 SwitchMap 中订阅 Observable
- c++ - 使用转换/比例从向量构造向量
- javascript - 忽略重复组内的正则表达式分组
- python - Holoviews 标签的旋转文本