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 trialJirayu Piriyametha
2,987 Pointscan not run script
>>> python lumberjack.py
File "<stdin>", line 1
python lumberjack.py
^
SyntaxError: invalid syntax
>>> python lumberjack.py
File "<stdin>", line 1
python lumberjack.py
^
SyntaxError: invalid syntax
>>>
4 Answers
William Li
Courses Plus Student 26,868 PointsI guess you're trying to run the script within the Python REPL, right?
You can tell the difference by looking at the prompt
- >>> you're at Python REPL
- treehouse:~/workspace$ you're at the Linux command line
The command you're using python lumberjack.py
will only work at the command line.
You should first exit the Python REPL by typing exit()
, now back into the Command line, you can enter the python lumberjack.py
Hope that helps
Jirayu Piriyametha
2,987 Pointstreehouse:~/workspace$ python lumberjack.py
treehouse:~/workspace$
thank you so much for answer but notting happen anyway (it should print "hello world")
William Li
Courses Plus Student 26,868 Pointscheck your lumberjack.py file, if it's empty, then of course nothing happens. If you want something happens like print out hello world
, you need to actually add the code to lumberjack.py
print("hello world")
and save the file; also please notice that during the lecture, Kenneth's lumberjack.py also has some codes on it that asks for user to input his name.
Jirayu Piriyametha
2,987 Pointsgoshhh I did it! what happen is I didn't save. thank you so much!
William Li
Courses Plus Student 26,868 Pointsno problem, so all good now?
Jirayu Piriyametha
2,987 Pointsyes all good now. New problem will come. stay tunes