Eric Milliot-Martinez
Eric Milliot-Martinez

Reputation: 4596

Flask web app ValidationError ImportError

I'm using flask-mongoengine==0.7.4 and I'm trying to run "manage.py runserver" from this repo and this commit.

I have mongo db installed and running, I can run "mongo" and connect to the "test" (default) database and modify it. I've also googled and came across this but I do not think I should have to upgrade since "fromzeroedu" didn't have to upgrade.

I get this error

Traceback (most recent call last):
  File "/home/ubuntu/workspace/flaskbook/manage.py", line 5, in <module>
    from application import create_app
  File "/home/ubuntu/workspace/flaskbook/application.py", line 2, in <module>
    from flask.ext.mongoengine import MongoEngine
  File "/home/ubuntu/workspace/flaskbook/venv/lib/python3.4/site-packages/flask/exthook.py", line 81, in load_module
    reraise(exc_type, exc_value, tb.tb_next)
  File "/home/ubuntu/workspace/flaskbook/venv/lib/python3.4/site-packages/flask/_compat.py", line 32, in reraise
    raise value.with_traceback(tb)
  File "/home/ubuntu/workspace/flaskbook/venv/lib/python3.4/site-packages/flask_mongoengine/__init__.py", line 16, in <module>
    from mongoengine.base import ValidationError
ImportError: cannot import name 'ValidationError'

Upvotes: 0

Views: 1639

Answers (1)

Sraw
Sraw

Reputation: 20214

This is an issue related to it's dependency. If you watch the setup.py of flask_mongoengine-0.7.4 (The version described in fromzeroedu's requirements.txt). It says this package depend on mongoengine>=0.7.10.

But check mongoenigne's v0.11.0 tag. It shows since version 0.11.0, Errors in base has been migrated into errors.

So I think it is enough to make you understand what happened. To fix this problem, you really need to upgrade flask_mongoengine or install an old version mongoengine below v0.11.0.

So in your requirements.txt, if you're gonna have: "flask-mongoengine==0.7.4" Then you better also specify this: "mongoengine==0.10.0" Because mongodb has screwed up their own dependencies!

Upvotes: 2

Related Questions