2

首先,我对 Python、Xwindows、Matplotlib 或 GTK 知之甚少。我正在尝试运行一个名为 SpliceGrapher 的工具,它使用上述内容。我收到一个(丑陋,抱歉)错误:

 /usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display
 warnings.warn(str(e), _gtk.Warning)
 /home/my/bin/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py:52: GtkWarning: gdk_cursor_new_for_display: assertion `GDK_IS_DISPLAY (display)' failed
 cursors.MOVE          : gdk.Cursor(gdk.FLEUR),
 Traceback (most recent call last):
 File "/home/my/bin/SpliceGrapher-0.2.0/scripts/view_splicegraphs.py", line 28, in <module>
    from pylab      import *
  File "/home/my/bin/lib64/python2.6/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
  File "/home/my/bin/lib64/python2.6/site-packages/matplotlib/pylab.py", line 264, in <module>
from matplotlib.pyplot import *
  File "/home/my/bin/lib64/python2.6/site-packages/matplotlib/pyplot.py", line 95, in <module>
new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/home/my/bin/lib64/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup
globals(),locals(),[backend_name])
  File "/home/my/bin/lib64/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module>
from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\
  File "/home/my/bin/lib64/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 52, in <module>
    cursors.MOVE          : gdk.Cursor(gdk.FLEUR),
  RuntimeError: could not create GdkCursor object

如果有人知道我能做什么,那就太好了。

我在 Linux (RedHat) 系统上,通过 puTTy 使用 Xming。我配置了 X11,并且 xeyes 显示了跟随我的鼠标的小眼睛,所以我知道那是有效的。

新错误:

16:00:46 view_splicegraphs.py Started
Traceback (most recent call last):
File "/home/bmoran/bin/SpliceGrapher-0.2.0/scripts/view_splicegraphs.py", line 164, in <module>
g = getFirstGraph(f)
File "/home/bmoran/bin/lib64/python2.6/site-packages/SpliceGrapher/SpliceGraph.py", line 371, in getFirstGraph
result = SpliceGraphParser(f, **args).next()
File "/home/bmoran/bin/lib64/python2.6/site-packages/SpliceGrapher/SpliceGraph.py", line 1351, in __init__
self.loadFromFile()
File "/home/bmoran/bin/lib64/python2.6/site-packages/SpliceGrapher/SpliceGraph.py", line 1424, in loadFromFile
raise ValueError("Graph feature found before graph header at line %d" % lineNo)
ValueError: Graph feature found before graph header at line 1
4

1 回答 1

4
 /usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py:57: GtkWarning: could not open display

告诉您您的脚本无权访问您的 X 会话。

你可以在这里发布你的脚本吗?

您是否使用 访问机器ssh -XC ...

当你发出shell时echo $DISPLAY你看到了什么?
当您添加脚本print os.getenv("DISPLAY")时,您会看到相同的结果吗?

还有一点注意...我不知道Xming,但我可以推荐你试试MobaXterm,它有一个为 Windows 编译的内置 ssh 和 X11 服务器,我猜它会解决你的 X 问题。

于 2012-12-03T15:56:12.373 回答