2012-12-03 85 views
1

首先,我對Python,Xwindows,Matplotlib或GTK知之甚少。我正在嘗試運行一個名爲SpliceGrapher的工具,它使用上述工具。我得到一個(醜,不好意思)錯誤:matplotlib gtk問題

/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)系統上,通過使用Xming的puTTy。我配置了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
/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,它有一個內置的ssh和X11服務器編譯的Windows,我的猜測是它可以解決你的X問題。

+0

好吧,我現在可以訪問X會話,我通過PuTTy登錄但嘗試過MobaXterm。 'echo $ DISPLAY'給出如果''localhost:12.0'不是拼寫錯誤,你可以運行以下命令來查找包含二進制文件的軟件包:-bash:localhost:12.0:command not found'我的新錯誤信息在上面,評論有點凌亂! – bruce01

+0

@你現在用的是mobaxterm嗎?您現在在代碼中有錯誤。請把你的代碼放在這裏,另外明智的是你不幫助我們來幫助你。 – Oz123

+0

得到它在MobaXterm工作,感謝您的建議Oz123 = D – bruce01