Why does this not work in PythonAnywhere 3.8? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why does this not work in PythonAnywhere 3.8?

https://code.sololearn.com/c4tV2opJqYsH/?ref=app Simple code I’m trying to do in PythonAnywhere gives me a syntax error. I don’t see why. Output is: File “<stdin>”, line 3 makeSquare(3) ^ SyntaxError: invalid syntax It works fine on here so whyyyyyy? It’s for an assignment of mine

24th Jun 2021, 8:52 PM
Jocelyn
Jocelyn - avatar
4 Answers
+ 2
run fine for me, with python3.5 on pythonanywhere... and also with python2.7.6 ^^ try to delete and rewrite your file... (avoid copy pasting to prevent invisible char wich could cause the error ;P) if still not working, wich versions of python is running your account (open a bash console, and read it after typing/executing "python" and "python3")? how did you run your script? (from file editor and "run" button, and/or from a bash console with "python scriptname" or "python3 scriptname": first would execute python2, second would execute python3?)
24th Jun 2021, 10:02 PM
visph
visph - avatar
0
Jocelyn Stainbrook since the error message refers to the (empty) line 3 try if it runs when you delete that line. If it does try if it runs if you make line 3 truly empty, i.e. no spaces, no tabs.
24th Jun 2021, 10:29 PM
Simon Sauter
Simon Sauter - avatar
0
Simon Sauter not sure that line 3 on original file refer to line 3 of code pkayground script, as the error seems to show the makeSquare(3) line ^^
24th Jun 2021, 10:31 PM
visph
visph - avatar
0
Simon Sauter and copy-pasting the code playground script in pythonanywhere file as is (with non empty line 3) do not prevent file to running fine ;)
24th Jun 2021, 10:35 PM
visph
visph - avatar