SyntaxError: multiple statements found while compiling a single statement
Cai Gengyang
gengyangcai at gmail.com
Sat Oct 8 02:29:13 EDT 2016
Unfortunately, in this case, it is 100% of the information I am giving you. You can try it yourself. The code is in the first section (8.1) of
http://programarcadegames.com/index.php?chapter=introduction_to_animation&lang=en#section_8
Just copy and paste it into your Python IDLE and let me know what you get ...
On Saturday, October 8, 2016 at 2:19:26 PM UTC+8, Steve D'Aprano wrote:
> On Sat, 8 Oct 2016 05:02 pm, Cai Gengyang wrote:
>
> > Any idea how to correct this error ? Looks fine to me ....
>
> As usual, the first and most important rule of debugging is to use ALL the
> information the compiler gives you. Where is the rest of the traceback? At
> the very least, even if nothing else, the compiler will print its best
> guess at the failed line with a caret ^ pointing at the place it realised
> there was an error.
>
> Asking us to debug your problem without giving us ALL the information is
> like that old joke:
>
>
> A man makes an appointment at the doctor because he isn't feeling
> well. He goes in to see the doctor, who says "So, Mr Smith, what
> seems to be the problem?"
>
> The man says "You're the medical expert, you tell me."
>
>
> I do not think it is possible to get the error message you claim from
> running the code you show. I think there is more code that you haven't
> shown us, and that the error is there.
>
> The only way I can reproduce the error message you give is by using the
> compile() function:
>
> py> compile("a=1\nb=2", "", "single")
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "<string>", line 1
> a=1
> ^
> SyntaxError: multiple statements found while compiling a single statement
>
>
> Notice how the compiler shows the offending line and puts a caret ^ at the
> end?
>
> Unless you show us what code actually causes this error message, I don't
> think it is possible to help you. We're not mind-readers.
>
>
>
>
>
> --
> 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