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 trialJeffrey Covington
7,246 PointsAttribute Error
After running the script I get the following:
Traceback (most recent call last):
File "journal.py", line 40, in <module>
initialize()
File "journal.py", line 21, in initialize
db.create_tables([Entry], safe=True)
File "/Users/jeffreycovington/anaconda/lib/python3.5/site-packages/peewee.py", line 3826, in create_tables
create_model_tables(models, fail_silently=safe)
File "/Users/jeffreycovington/anaconda/lib/python3.5/site-packages/peewee.py", line 5268, in create_model_tables
for m in sort_models_topologically(models):
File "playhouse/_speedups.pyx", line 345, in playhouse._speedups.sort_models_topologically (playhouse/_speedups.c:7144)
File "stringsource", line 67, in cfunc.to_py.__Pyx_CFunc_tuple____object___to_py.wrap (playhouse/_speedups.c:8293)
File "playhouse/_speedups.pyx", line 327, in playhouse._speedups._sort_key (playhouse/_speedups.c:6704)
AttributeError: type object 'Entry' has no attribute '_meta'
Note: I called my file journal.py
Any ideas?
[MOD: added ```python formatting -cf]
1 Answer
Chris Freeman
Treehouse Moderator 68,457 PointsDid you include the Meta
definition in the Entry
class definition:
class Entry(Model):
class Meta:
database = db
Jonathon Grant
21,526 PointsJonathon Grant
21,526 Pointscan you please provide your script here for review?