Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Python workspace didn't work to run a file.

I was going to run a saved file with: python notes.py

But terminal said: SyntaxError: invalid syntax

Please help

6 Answers

Michael Joyce
Michael Joyce
6,214 Points

You might be in a python shell while trying to execute this. Try exit() then attempt python notes.py again (assuming you are using OSX).

I'm using Mozilla Firefox, Windows7 32 bit

Michael Joyce
Michael Joyce
6,214 Points

Sorry I thought you were performing this locally on your machine. I think you can still try exit() in workspaces.

I did. No help

I have to use python IDLE still. Any ideas for solution please ?

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

When it says SyntaxError, does it give a line number or snippet of code that holds the syntax error? If so, can you share it with us?

There is no code snippet. Just that what I wrote

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

So that makes me think you did python notes.py while you were still in a Python shell. Try running exit() first (you should see the >>> disappear) and then run your script.