SyntaxError: multiple statements found while compiling a single statement
Cai Gengyang
gengyangcai at gmail.com
Sat Oct 8 23:51:49 EDT 2016
I defined both done and pygame in this piece of code, but now i get a new error that i have never seen before, an AttributeError
>>> rect_x = 50
>>> rect_y = 50
>>> done = False
>>> pygame = True
>>> while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
Traceback (most recent call last):
File "<pyshell#48>", line 2, in <module>
for event in pygame.event.get():
AttributeError: 'bool' object has no attribute 'event'
On Sunday, October 9, 2016 at 11:42:33 AM UTC+8, Steve D'Aprano wrote:
> On Sun, 9 Oct 2016 01:51 pm, Cai Gengyang wrote:
>
> > This is my latest result : I copy and pasted one line at a time into the
> > IDLE and used ONLY the "enter-return" button to move on to the next line
> > and this time I didnt get an indentation error but instead a traceback
> > error:
>
> > Traceback (most recent call last):
> > File "<pyshell#12>", line 1, in <module>
> > while not done:
> > NameError: name 'done' is not defined
>
> Right.
>
> That's because 'done' is not defined.
>
> Why don't you try my suggestion of saving the code into a .py file, then
> using the File > Open command to open it?
>
>
>
>
> --
> Steve
> “Cheer up,” they said, “things could be worse.” So I cheered up, and sure
> enough, things got worse.
More information about the Python-list
mailing list