Python:绘制投影仪的树图中出错

时间:2017-04-12 08:39:53

标签: python graph

使用投币器显示树形图时出现问题。具体是“prob.Tree.display”行。这个问题解决了/不用这一行。

这是错误:

Traceback (most recent call last):
  File "C:/Users/Timothy/Desktop/desktop/uni/fourth year/sem1/761/assign1/knapsack_func1.py", line 77, in <module>
    solve_knapsack(prob)
  File "C:/Users/Timothy/Desktop/desktop/uni/fourth year/sem1/761/assign1/knapsack_func1.py", line 59, in solve_knapsack
    prob.Tree.display()
  File "C:\Python2711\lib\site-packages\coinor\gimpy\graph.py", line 1752, in display
    window.set_dotcode(self.to_string())
  File "C:\Python2711\lib\site-packages\xdot.py", line 2010, in set_dotcode
    if self.widget.set_dotcode(dotcode, filename):
  File "C:\Python2711\lib\site-packages\xdot.py", line 1541, in set_dotcode
    xdotcode = self.run_filter(dotcode)
  File "C:\Python2711\lib\site-packages\xdot.py", line 1523, in run_filter
    universal_newlines=True
  File "C:\Python2711\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python2711\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Process finished with exit code 1

下面是收到错误的代码:

 if prob.display_mode != 'off':
    print "Number of nodes =", len(prob.Tree.get_node_list())
    if (prob.display_mode == 'pygame') or (prob.display_mode == 'xdot'):
        prob.Tree.display()

如果需要,可以提供更多代码

由于

0 个答案:

没有答案