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 Using Databases in Python Meet Peewee Modeling

Yuyang Peng
Yuyang Peng
5,665 Points

things from peewee may be undefined or defined from star imports

Hey guys, I m using spyder3 and typed the code Kenneth did, but it tells me that they are all not defined. Anyone please :(

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Could you please post the code and the error message

Yuyang Peng
Yuyang Peng
5,665 Points

Thank you Dave from peewee import *

db = SqliteDatabase('students.db')

class Student(Model): username = CharField(max_length=255, unique=True) points = IntergerField(default=0)

class Meta:
    database = db

if name == 'main': db.connect() db.create_tables([Student], safe=True)

File "C:/Users/Tommy/.spyder-py3/peeweepractice.py", line 16, in Student points = IntergerField(default=0)

NameError: name 'IntergerField' is not defined

3 Answers

You probably need to install peewee via:

pip3 install peewee
Yuyang Peng
Yuyang Peng
5,665 Points

Thank you Alex, Yeah I ve already installed that, but still it doesnt work, wishing I could post a screenshot but it won't allow me

Yuyang Peng
Yuyang Peng
5,665 Points

So I just downloaded and installed mySQL, is it right that we need it installed? How do we use it? Cuz my spyder still gives me error

Yuyang Peng
Yuyang Peng
5,665 Points

Okay I am so freaking embarrassed right now, cuz I had a typo there.......I typed interger instead of integer.....problem solved everyone..... Thank you all for commenting and trying to help me out !