Python:“NameError:全局名称'箭头'未定义”

时间:2013-12-25 11:07:43

标签: python ubuntu nameerror wine vpython

我是Python的初学者,我正在尝试运行以下代码: http://www.physics.orst.edu/~rubin/Books/eBookWorking/html/Ising.html

当我尝试执行此代码时,出现以下错误:

Traceback (most recent call last):
  File "C:\simulations\ising\ising.py", line 53
    spstate(state)                      # plots initial state: all spins down
  File "C:\simulations\ising\ising.py", line 47, in spstate
    arrow(pos=(i,ypos,0), axis=(0,5*state[j],0), color=arrowcol)
NameError: global name 'arrow' is not defined

这很奇怪,因为箭头应该是VPython的一个功能: http://www.vpython.org/contents/docs/arrow.html

我在VIDLE VPython的葡萄酒下用Ubuntu 12.04运行它。

如果我从Ubuntu本地运行此代码,它仍然没有被执行,但错误信息是不同的:

(python:12493): GdkGLExt-WARNING **: Cannot open \u000c

(python:12493): GdkGLExt-WARNING **: Cannot open \xa0\xbc\u0005X\x8a\u007f
(python:12493): glibmm-ERROR **: 
unhandled exception (type std::exception) in signal handler:
what: Unable to get extension function: glCreateProgramObjectARB even though the extension is advertised.

Trace/breakpoint trap (core dumped)

由于我不熟悉Python编程和错误消息,我有点迷茫,不知道从哪里开始寻找错误来源。

0 个答案:

没有答案