Very first Python program generates a syntax error - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Very first Python program generates a syntax error (/thread-1932.html) |
Very first Python program generates a syntax error - n8ves - Feb-05-2017 I typed in my first Python program (Hello World!) EXACTLY as it appeared in print. #! /usr/bin/python print "Hello World!"I used chmod to make it an executable file. When I went to run the file, it generated the following: File "./hello.py", line 3 SyntaxError: Non-ASCII character '\xc2' in file ./hello.py on line 3, but no encoding declared It should have ran just fine. I did notice that on my Pi, when I actually attempt to type in the following characters `~^'" I have to type them in TWICE for them to appear on the screen. And it doesn't matter if I am typing then into IDLE, nano or in the CLI. Any suggestions? RE: Very first Python program generates a syntax error - Skaperen - Feb-05-2017 do od -Ax -tx1 -w32 filename on your script file.
RE: Very first Python program generates a syntax error - n8ves - Feb-07-2017 It turns out that the keyboard wasn't mapped quite right in Raspbian Jessie. Once I got that corrected and the program edited, it ran just fine. Thanks for replying Skaperen... |