SyntaxError: multiple statements found while compiling a single statement

Steve D'Aprano steve+python at pearwood.info
Sat Oct 8 23:42:19 EDT 2016


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