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 trialLibby Elliott
450 PointsKeep getting error ModuleNotFoundError: No module named 'hello.py'; 'hello' is not a package
I keep getting the following error when I try to run my file. I've imported the file because i get this issue if not.
python hello.py
File "<stdin>", line 1
python hello.py
^
SyntaxError: invalid syntax
treehouse:~/workspace$ python
Python 3.6.4 (default, Nov 19 2019, 17:12:46)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
hello.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'hello' is not defined
import hello.py
what is your first name? Libby
hello, Libby
Libby is learning
Have a great day Libby1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'hello.py'; 'hello' is not a package
3 Answers
Libby Elliott
450 PointsThank you - here is a snapshot https://w.trhou.se/anpfshbjym
Steven Parker
231,271 PointsThe snapshot made it all clear! Without Markdown formatting, the ">>>" prompt in your example was being converted into a triple-indented blockquote!
So anyway, that prompt indicates that you are already running Python. But "python hello.py" is a command to be given to the system to cause python to run, and to also start up your program.
Here's what happens if you don't run "python" by itself first (with intentional blockquote):
treehouse:~/workspace$ Β python hello.py
what is your first name? Libby
hello, Libby
Libby is learning
Have a great day Libby1
treehouse:~/workspace$
Libby Elliott
450 PointsThank you so much! I have finally been able to move through to the video's :) I was getting really confused but my code was actually perfect the whole time. :)
Steven Parker
231,271 PointsLibby Elliott β Glad to help. You can mark the question solved by choosing a "best answer".
And happy coding!
Steven Parker
231,271 PointsSteven Parker
231,271 PointsI would be helpful to see the entire project, make a snapshot of your workspace and post the link to it here.