Search code examples
flask-adminmarshmallow

When importing Flask-Marshmallow Unexpected keyword argument error


I have a small project running Flask-Admin which I have dockerised. All of a sudden I can't get the project to build. I've gone through previous commits and can't work out what the issue is. It appears to be the importing of flask-marshmallow but I can't get any further information as to what is causing it.

from flask import Flask, render_template, url_for, redirect
from flask_admin import Admin, AdminIndexView
from flask_sqlalchemy import SQLAlchemy
from flask_admin.contrib.sqla import ModelView
from flask_security import Security, SQLAlchemyUserDatastore, current_user, login_required, utils
from wtforms.fields import PasswordField
flask_admin import helpers as admin_helpers
from flask_marshmallow import Marshmallow

app = Flask(__name__)
app.config.from_pyfile('config.py', silent=True)

db = SQLAlchemy(app)
ma = Marshmallow(app)

and the traceback is:

Traceback (most recent call last):
admin |   File "parcelnotifier.py", line 1, in <module>
admin |     from app import app
admin |   File "./app/__init__.py", line 8, in <module>
admin |     from flask_marshmallow import Marshmallow
admin |   File "/usr/local/lib/python3.5/dist-packages/flask_marshmallow/__init__.py", line 29, in <module>
admin |     from . import sqla
admin |   File "/usr/local/lib/python3.5/dist-packages/flask_marshmallow/sqla.py", line 13, in <module>
admin |     import marshmallow_sqlalchemy as msqla
admin |   File "/usr/local/lib/python3.5/dist-packages/marshmallow_sqlalchemy/__init__.py", line 4, in <module>
admin |     from .schema import (
admin |   File "/usr/local/lib/python3.5/dist-packages/marshmallow_sqlalchemy/schema.py", line 98, in <module>
admin |     class TableSchema(with_metaclass(TableSchemaMeta, ma.Schema)):
admin |   File "/usr/local/lib/python3.5/dist-packages/marshmallow/compat.py", line 66, in __new__
admin |     return meta(name, bases, d)
admin |   File "/usr/local/lib/python3.5/dist-packages/marshmallow/schema.py", line 106, in __new__
admin |     klass.opts = klass.OPTIONS_CLASS(meta, ordered=ordered)
admin  | TypeError: __init__() got an unexpected keyword argument 'ordered'

Solution

  • I just installed from scratch a Flask project and the dependencies and I have the same exact error. It seems that the marshmallow package has beend updated yersterday: https://pypi.python.org/pypi/marshmallow "Uploaded : 2017-03-10"

    This bug has been reported to the dev team: https://github.com/marshmallow-code/marshmallow/issues/597