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!

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


"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:

Class Thief:
  sneaky = True

1 Answer

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