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 trialtaahrqqhar
14,147 PointsI keep getting error when trying to load python hello.py on console
I keep getting error when trying to load python hello.py on console
python hello.py File "<stdin>", line 1 python hello.py ^ SyntaxError: invalid syntax
2 Answers
Robert Richey
Courses Plus Student 16,352 PointsHi Joe,
I get that same error when trying to do that within the python shell. To run a python program, we need to be outside the shell.
treehouse:~/workspace$ python hello.py
Hope this helps,
Cheers
taahrqqhar
14,147 Pointsgot it.. i just understood it. i was confused about why when i type python it took me inside the shell.
taahrqqhar
14,147 Pointstaahrqqhar
14,147 Pointsthanks bro
taahrqqhar
14,147 Pointstaahrqqhar
14,147 PointsO man this thing aint working now... how do i get of the shell
Robert Richey
Courses Plus Student 16,352 PointsRobert Richey
Courses Plus Student 16,352 PointsType
exit()
from within the shell, to exit it.Denny Ho
4,472 PointsDenny Ho
4,472 PointsHi Robert, Sorry to sorta hijack this but I was wondering why it is that we can't load a script from within the python shell? So anytime we want to run a python script, we'd have to quit and then do
treehouse:~/workspace$ python script_name.py
every time instead of just typing script_name.py while within the python shell?