I'm starting with Elixir and SQL Alchemy. I've created a python file connecting with a Mysql database to but as soon as I execute with python I get the error bellow:
root@raspberrypi:/Python/mainFlask/yonkiPOPS# python yonki.py
Traceback (most recent call last):
File "yonki.py", line 1, in <module>
from elixir import metadata, Entity, Field
File "/usr/local/lib/python2.7/dist-packages/Elixir-0.7.1-py2.7.egg/elixir/__init__.py", line 29, in <module>
from elixir.entity import Entity, EntityBase, EntityMeta, EntityDescriptor, \
File "/usr/local/lib/python2.7/dist-packages/Elixir-0.7.1-py2.7.egg/elixir/entity.py", line 17, in <module>
from sqlalchemy.orm import MapperExtension, mapper, object_session, \
ImportError: cannot import name ScopedSession
I have been looking for it but I don't find the reason. This is the yonki.py file:
from elixir import metadata, Entity, Field
from elixir import Unicode, UnicodeText
from elixir import *
class User(Entity):
username = Field(String(64))
metadata.bind = 'mysql://root:nomasandroid42@localhost/yonkiPOPS'
session.bind.echo = True
setup_all()
create_all()
I think that it's maybe due to a required module not installed but I don't know which one.
Just open the ./elixir/entity.py, find the import line like this:
from sqlalchemy.orm import ScopedSession, \
then adjust it to:
from sqlalchemy.orm import scoped_session as ScopedSession, \