Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

"SyntaxError: invalid syntax" during import

Hello! I am getting the following error when trying to import a class on the console, as shown on the tutorial video. What could be the problem with this syntax below?

treehouse:~/workspace$ ls                                                                                                                                                                                        
characters.py  oops.py                                                                                                                                                                                           
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.                                                                                                                                           
>>> from characters import Thief                                                                                                                                                                                 
Traceback (most recent call last):                                                                                                                                                                               
  File "<stdin>", line 1, in <module>                                                                                                                                                                            
  File "/home/treehouse/workspace/characters.py", line 1                                                                                                                                                         
    Class Thief:                                                                                                                                                                                                 
              ^                                                                                                                                                                                                  
SyntaxError: invalid syntax                                                                                                                                                                                      

Original code:

#characters.py
Class Thief:
  sneaky = True

1 Answer

In characters.py class should begin with a lowercase c.