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
왜 파이썬 쉘에서 직접 코드를 입력 할 때 GASP 만 실행 않지만, 내가 파이썬 스크립트를 실행할 때 작동하지 않는 이유는 무엇입니까?
감사합니다. 작동합니다. –