SyntaxError: multiple statements found while compiling a single statement

breamoreboy at gmail.com breamoreboy at gmail.com
Sat Oct 8 07:46:43 EDT 2016


On Saturday, October 8, 2016 at 12:07:47 PM UTC+1, Rustom Mody wrote:
> On Saturday, October 8, 2016 at 1:21:50 PM UTC+5:30, Cai Gengyang wrote:
> > This is the result when I copy and paste it one line at a time :
> > 
> > >>> rect_x = 50
> > >>> rect_y = 50
> > >>> while not done:									
> >  for event in ...
> <etc>
> 
> There's sure something strange about your formatting
> 
> you want something like this I think:
> 
> rect_x = 50
> rect_y = 50
> while not done:
>     for event in pygame.event.get():
>         if event.type == pygame.QUIT:
>             done = True
> 
> On a related note in addition to Steven's 2 suggestions
> - paste 1 line at a time
> - Write the code in a py file
> 
> you could also try it out without Idle
> ie start python at your shell (or terminal or cmd.exe or whatever)
> And try it there

The easiest way is to use the ipython %paste magic command.

Kindest regards.

Mark Lawrence.



More information about the Python-list mailing list