inveniosoftware / troubleshooting

DEPRECATED - Use the forum instead:
https://invenio-talk.web.cern.ch
5 stars 4 forks source link

TypeError: can't pickle instancemethod objects #10

Open nharraud opened 7 years ago

nharraud commented 7 years ago

Problem: Travis fails to build some modules in "devel" mode with python 2.7. The stack trace is:

[...]

../../../virtualenv/python2.7.9/lib/python2.7/site-packages/flask/app.py:1856: in process_response
    response = handler(response)
../../../virtualenv/python2.7.9/src/invenio-accounts/invenio_accounts/sessions.py:74: in add_user_session
    app.session_interface.save_session(app, flask.session, response)
../../../virtualenv/python2.7.9/lib/python2.7/site-packages/flask_kvsession/__init__.py:187: in save_session
    data = self.serialization_method.dumps(dict(session))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <bound method Domain.gettext of <flask_babelex.Domain object at 0x7f15c48b6f90>>
proto = 0
    def _reduce_ex(self, proto):
        assert proto < 2
        for base in self.__class__.__mro__:
            if hasattr(base, '__flags__') and not base.__flags__ & _HEAPTYPE:
                break
        else:
            base = object # not really reachable
        if base is object:
            state = None
        else:
            if base is self.__class__:
>               raise TypeError, "can't pickle %s objects" % base.__name__
E               TypeError: can't pickle instancemethod objects

Origin: This happens because flask-security-fork switched to localized strings (see https://github.com/inveniosoftware/flask-security-fork/pull/38). This issue will be fixed only in flask-security as flask-security-fork will be deprecated.

Solution: For now we can remove flask-security-fork from the devel dependencies. We can add flask-security once we switch to it.

jirikuncar commented 7 years ago

@nharraud it has been fixed in https://github.com/mattupstate/flask-security/commit/7c9c1b3e491980c1d42540b665f1abce187bff6e. Can you please test it?