[Tutor] Issues In Terminal
steve at pearwood.info
Mon Sep 27 00:18:56 CEST 2010
On Mon, 27 Sep 2010 07:55:40 am Bill DeBroglie wrote:
> Which is great, but when I try and run the same code in the Terminal
> by calling a program I've written (print("hello world") again) I get
> the following:
How do you call the program?
At the shell prompt, if you call:
does it work?
Looking at the error you get, it looks like OS-X is treating the program
as a shell script, not a Python script:
> matthews-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py
> ./chapter_2.py: line 4: syntax error near unexpected token `"Hello
> ./chapter_2.py: line 4: `print("Hello World")'
That's not a Python error message, so it's probably a shell error. You
need to teach the shell how to treat it, either by explicitly calling
python, as above, or by inserting a "hash-bang" line at the very top of
should do it.
More information about the Tutor