[Tutor] Issues In Terminal

Marc Tompkins marc.tompkins at gmail.com
Mon Sep 27 00:06:04 CEST 2010

On Sun, Sep 26, 2010 at 2:55 PM, Bill DeBroglie <bill.debroglie at gmail.com>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:
>        matthews-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py
>        ./chapter_2.py: line 4: syntax error near unexpected token `"Hello
> World"'
>        ./chapter_2.py: line 4: `print("Hello World")'
> I'm using a Mac OS X 10.5.8. I had previously downloaded Python 2.6.5 AND
> 3.1 and had them both on this computer simultaneously but was having trouble
> with 3.1 crashing. I have since put both in the trash but obviously still
> have 2.6.5 on my system, I assume that was the version pre-installed on this
> Mac.

I think that's a shell issue, not specifically a Python issue.  You need to
include a line at the top of the script to tell the OS how to find the
Python interpreter.  Try adding this line at the beginning:

> #!/usr/bin/env python
> Your default Python install probably is NOT installed at /usr/bin/python,
but there should be a symbolic link there that points to the actual
location.  If not, you'll need to adjust things a bit.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100926/eabbcea7/attachment.html>

More information about the Tutor mailing list