인터프리터 모드를 사용하면 from gasp import *
이 실행되지만 스크립트에 배치 할 때 그렇지 않습니다. 나는 이것을 제 4 장 How to Think Like a Computer Scientist: Learning with Python (4.11. GASP 아래에 있음)에서 바로 복사하고있다.난이도 : 스크립트를 사용하여 GASP 가져 오기
스크립트 :
from gasp import *
begin_graphics()
Circle((200, 200), 60)
Line((100, 400), (580, 200))
Box((400, 350), 120, 100)
update_when('key_pressed')
end_graphics()
터미널 :
[email protected]:~$ python '/home/ben/Documents/Python/gasp.py'
Traceback (most recent call last):
File "/home/ben/Documents/Python/gasp.py", line 1, in <module>
from gasp import *
File "/home/ben/Documents/Python/gasp.py", line 3, in <module>
begin_graphics()
NameError: name 'begin_graphics' is not defined
+1 질문을하지 않고 첫 번째 질문에 전체 추적을 포함 시켜서 실제로 문제를 디버깅 할 수있는 충분한 정보를 제공합니다. – agf