0

I am having trouble because the syntax of my Python3 code is just fine. I just downloaded python 3.3.2 on my Mac 10.6.8.

Here is my code in IDLE and then my TERMINAL error message. When I run the program through IDLE, the syntax error message highlights the second "3" in python 3.3.2. What is going on??

IDLE:

Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 12:45:22) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin
Type "copyright", "credits" or "license()" for more information.
>>> print("Hello")
Hello
>>> 

TERMINAL ERROR MESSAGE:

File "hello.py", line 1
Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 12:45:22) 
         ^
SyntaxError: invalid syntax
1
  • You should not have the garbage at the start of your file; it was produced by Python when you started running it. Just start with the line Print("hello") as your first line. Commented May 31, 2013 at 4:37

2 Answers 2

1

Put only the line:

print("Hello")

into hello.py.

Sign up to request clarification or add additional context in comments.

Comments

1

I guess your script contains the line:

Python 3.3.2 (v3.3.2:d047928ae3f6, May 13 2013, 12:45:22) 

it should be only

print("hello")

or even better

#! /usr/bin/env python
print("hello")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.