peewee: object has no attribute _meta
attributeerror, peewee, python, python-3.x
Solution
Peewee is not Python 3 compatible; it only works with Python 2 at the moment.
The error you see is a result of that; the `Model` class defines a metaclass using Python 2 techniques, which have changed for Python 3.
Update: Version 2.1, released 2013-04-02, adds Python 3 compatibility. The package now supports Python 2.6, 2.7, and 3.2 and up.
Problem
I am working on Windows with Python 3.3 32-bit. I have installed peewee and want to try some of its features. I have started with Peewee Quickstart (http://peewee.readthedocs.org/en/latest/peewee/quickstart.html). My code looks like this: ``` from peewee import * db = SqliteDatabase('people.db') class Person(Model): name = CharField() birthday = DateField() is_relative = BooleanField() class Meta: database = db class Pet(Model): owner = ForeignKeyField(Person, related_name = "pets") name = CharField() animal_type = CharField() class Meta: database = db Person.create_table() Pet.create_table() ``` and I get an error: ``` File "<stdin>", line 1, in <module> File "<string>", line 21, in <module> File "C:\Python33\lib\site-packages\peewee.py", line 2094, in create_table db = cls._meta.database AttributeError: type object 'Person' has no attribute '_meta' ``` Is something wrong with my installation of peewee? How can I resolve this issue?