3
我輸入下面的命令到終端:爲什麼GASP只有在終端感應時才能正常工作?
[email protected]:~$ python
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gasp import *
>>> begin_graphics()
>>> Closed.
[email protected]:~$ touch gasp.py
[email protected]:~$ echo "from gasp import *" >> gasp.py
[email protected]:~$ echo "begin_graphics()" >> gasp.py
[email protected]:~$ cat gasp.py
from gasp import *
begin_graphics()
[email protected]:~$ python gasp.py
Traceback (most recent call last):
File "gasp.py", line 1, in <module>
from gasp import *
File "/home/br/gasp.py", line 2, in <module>
begin_graphics()
NameError: name 'begin_graphics' is not defined
爲什麼當我在Python Shell直接輸入代碼並GASP只運行,但是當我執行一個Python腳本,它不工作?
謝謝,它的工作原理。 –