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 Object-Oriented Python Instant Objects Let's Make a Class!

Ingrid Matthews
Ingrid Matthews
1,465 Points

Trouble importing

I am not able to practice any of this because I can't get started with the workspace! What am I missing? Thanks!

treehouse:~/workspace$ from characters import Thief
from: can't read /var/mail/characters
treehouse:~/workspace$ python3 characters.py
Traceback (most recent call last):
File "characters.py", line 1, in <module>
class Thief:
File "characters.py", line 2, in Thief
kenneth = Thief()
NameError: name 'Thief' is not defined
treehouse:~/workspace$

1 Answer

Steven Parker
Steven Parker
231,275 Points

Before you enter any Python commands, you need to start the Python application itself:

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.                                               
>>>

The ">>>" prompt shows you that Python is running and ready for you to type.