Forums

RuntimeWarning: tp_compare didn't return -1 or -2 for exception

These lines seem to be the cause of the error (i.e. the app works when I comment them out, but I get the error below when they are uncommented). This works fine on my local machine, is there something I need to do differently on PA? Please feel free to look at my files if it helps diagnose.

path = '/tmp/app_session'
if not os.path.exists(path):
    os.mkdir(path)
    os.chmod(path, int('700', 8))
app.session_interface = SqliteSessionInterface(path)

LOG:

2015-05-19 22:28:16,368 :/usr/lib/python2.7/threading.py:1160: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
2015-05-19 22:28:16,369 :  return _active[_get_ident()]
2015-05-19 22:28:16,369 :Traceback (most recent call last):
2015-05-19 22:28:16,369 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2015-05-19 22:28:16,369 :    self.error_log_file.logger.exception("Error running WSGI application")
2015-05-19 22:28:16,369 :  File "/usr/lib/python2.7/logging/__init__.py", line 1185, in exception
2015-05-19 22:28:16,369 :    self.error(msg, *args, **kwargs)
2015-05-19 22:28:16,370 :  File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
2015-05-19 22:28:16,370 :    self._log(ERROR, msg, args, **kwargs)
2015-05-19 22:28:16,370 :  File "/usr/lib/python2.7/logging/__init__.py", line 1270, in _log
2015-05-19 22:28:16,370 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2015-05-19 22:28:16,371 :  File "/usr/lib/python2.7/logging/__init__.py", line 1244, in makeRecord
2015-05-19 22:28:16,371 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2015-05-19 22:28:16,371 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2015-05-19 22:28:16,371 :    self.threadName = threading.current_thread().name
2015-05-19 22:28:16,371 :  File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
2015-05-19 22:28:16,372 :    return _active[_get_ident()]
2015-05-19 22:28:16,372 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2015-05-19 22:28:16,372 :    app_iterator = self.app(environ, start_response)
2015-05-19 22:28:16,372 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
2015-05-19 22:28:16,376 :    return self.wsgi_app(environ, start_response)
2015-05-19 22:28:16,377 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 1813, in wsgi_app
2015-05-19 22:28:16,378 :    ctx.push()
2015-05-19 22:28:16,378 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/ctx.py", line 321, in push
2015-05-19 22:28:16,379 :    self.session = self.app.open_session(self.request)
2015-05-19 22:28:16,379 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 825, in open_session
2015-05-19 22:28:16,380 :    return self.session_interface.open_session(self, request)
2015-05-19 22:28:16,380 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 124, in open_session
2015-05-19 22:28:16,381 :    rv = SqliteSession(self.directory, sid)
2015-05-19 22:28:16,381 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 30, in __init__
2015-05-19 22:28:16,382 :    with self._get_conn() as conn:
2015-05-19 22:28:16,382 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 70, in _get_conn
2015-05-19 22:28:16,383 :    self.conn = sqlite3.Connection(self.path)
2015-05-19 22:28:16,383 :sqlite3.OperationalError: unable to open database file

[ edited by admin: formatting ]

If you look at the bottom of your log, can you say add a print self.path to see if perhaps a wrong path has been passed in? That would help with debugging. You'd have to print to stderr to see it in the error log.

Here's what I got when I printed the path, the "/usr/lib/python2.7" at the end looks a little out of place.

/tmp/app_session/.eJxFzkELgjAYgOG_Et9ZImUQCEHBCjx8i2AV20VKp276GUwlM_rvRR06vpeH9wlp4U1XQdz7wQSQ2hziJ8yuEAPyjGmuRpQ4imnn9hwZTvWouSZ0J1LywIQsJ01qBa8Ass4XaX-rTfsnpnqBPHdIigk6WU3HULhtJBzeVZQwLcuHlqLCaOcE39zVebvQm9WXKz5AOzRNAENnfJInbQ9x-KvvJpC3fVZZswyjdUkX28yzG8HrDbniRT0.CD4NMw.ErWP706Evv1UYMekk7Dj9cQ5OFo/usr/lib/python2.7

ok- i would suggest putting print statements up higher to see where this /usr/lib/python2.7 got added in mistakenly.

Ok, that /usr/lib/python2.7 is not from the path, it's from the error message after, here's the full log with my print statements:

2015-05-21 13:24:15,072 :##########1 PRINT OUT START##########/tmp/app_session/d72d5972-e978-431a-9c16-02079ae75927##########1 PRINT OUT END####################2 PRINT OUT START##########/tmp/app_session/d72d5972-e978-431a-9c16-02079ae75927##########2 PRINT OUT END####################1 PRINT OUT START##########/tmp/app_session/.eJxN0NtugjAAANBfWfosiQrMS-IDCKhAiyBQ22UhisC4o6h0GP99y7Jk-4HzcB4gSE9g_gAvRzAHUAkFqhAGXchQr2WWAgXY54wqtISZXxLXFpCb9LQkC_AcgLC9xMG1zqPqj3BVnmL0YWGUoTEUCdZKWKo9dfMRzdQhGXs8VSAPXTmFK8ijXhIse_HDxd9AdSuKASjSKo9OafUPv4L5G5BsLN_t2o9nY2WJqEN8x6i2Cj7jTeSwXVLInbeb2gGtO8NpubA-t6VpLMXrVDzKWc2NhBm9T8xLcxoPSSd5beWJr-rGz1OGVyFN2kmvW3o20c6rmHEqY1Hhi5WW7g86kcyoFeQm0NfhhWMz4uHocAm3hgyTvblZJagp164ROl1mNKEVo5sVf5pSAga_M-D5_nx-AY3zeFA.CD9mRA._Ui9XOuMvX_G-NoGTvjDzn6NcaQ##########1 PRINT OUT END####################2 PRINT OUT START##########/tmp/app_session/.eJxN0NtugjAAANBfWfosiQrMS-IDCKhAiyBQ22UhisC4o6h0GP99y7Jk-4HzcB4gSE9g_gAvRzAHUAkFqhAGXchQr2WWAgXY54wqtISZXxLXFpCb9LQkC_AcgLC9xMG1zqPqj3BVnmL0YWGUoTEUCdZKWKo9dfMRzdQhGXs8VSAPXTmFK8ijXhIse_HDxd9AdSuKASjSKo9OafUPv4L5G5BsLN_t2o9nY2WJqEN8x6i2Cj7jTeSwXVLInbeb2gGtO8NpubA-t6VpLMXrVDzKWc2NhBm9T8xLcxoPSSd5beWJr-rGz1OGVyFN2kmvW3o20c6rmHEqY1Hhi5WW7g86kcyoFeQm0NfhhWMz4uHocAm3hgyTvblZJagp164ROl1mNKEVo5sVf5pSAga_M-D5_nx-AY3zeFA.CD9mRA._Ui9XOuMvX_G-NoGTvjDzn6NcaQ##########2 PRINT OUT END##########/usr/lib/python2.7/threading.py:1160: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
2015-05-21 13:24:15,073 :  return _active[_get_ident()]
2015-05-21 13:24:15,073 :Traceback (most recent call last):
2015-05-21 13:24:15,073 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2015-05-21 13:24:15,073 :    self.error_log_file.logger.exception("Error running WSGI application")
2015-05-21 13:24:15,073 :  File "/usr/lib/python2.7/logging/__init__.py", line 1185, in exception
2015-05-21 13:24:15,073 :    self.error(msg, *args, **kwargs)
2015-05-21 13:24:15,073 :  File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
2015-05-21 13:24:15,074 :    self._log(ERROR, msg, args, **kwargs)
2015-05-21 13:24:15,074 :  File "/usr/lib/python2.7/logging/__init__.py", line 1270, in _log
2015-05-21 13:24:15,074 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2015-05-21 13:24:15,074 :  File "/usr/lib/python2.7/logging/__init__.py", line 1244, in makeRecord
2015-05-21 13:24:15,074 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2015-05-21 13:24:15,074 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2015-05-21 13:24:15,075 :    self.threadName = threading.current_thread().name
2015-05-21 13:24:15,075 :  File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
2015-05-21 13:24:15,075 :    return _active[_get_ident()]
2015-05-21 13:24:15,075 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2015-05-21 13:24:15,075 :    app_iterator = self.app(environ, start_response)
2015-05-21 13:24:15,075 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
2015-05-21 13:24:15,076 :    return self.wsgi_app(environ, start_response)
2015-05-21 13:24:15,076 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 1813, in wsgi_app
2015-05-21 13:24:15,077 :    ctx.push()
2015-05-21 13:24:15,077 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/ctx.py", line 321, in push
2015-05-21 13:24:15,077 :    self.session = self.app.open_session(self.request)
2015-05-21 13:24:15,077 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 825, in open_session
2015-05-21 13:24:15,078 :    return self.session_interface.open_session(self, request)
2015-05-21 13:24:15,078 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 131, in open_session
2015-05-21 13:24:15,078 :    rv = SqliteSession(self.directory, sid)
2015-05-21 13:24:15,078 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 34, in __init__
2015-05-21 13:24:15,079 :    with self._get_conn() as conn:
2015-05-21 13:24:15,079 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 77, in _get_conn
2015-05-21 13:24:15,079 :    self.conn = sqlite3.Connection(self.path)
2015-05-21 13:24:15,079 :sqlite3.OperationalError: unable to open database file

One more note, I don't think this is purely a threading issue, because I had this working on PyAny a week ago.

Did you recently increase your number of workers (by upgrading to a paid account or adding workers to your plan)?

No, I've had a paid account for several months and I don't know how to increase workers. Is that a config I can try changing?

Then it's probably not the issue. I noticed that there are several logs of the same file and thought there might be a race between different workers. If you'd added a worker recently, it could have been the cause of the issue. Since you haven't, I'm still puzzled about what's going on.

Here is sqliteSession.py, I'm using it to store variable across the session, works fine on my local environment.

import os, errno, sqlite3
import sys
from uuid import uuid4
from cPickle import dumps, loads
from collections import MutableMapping
from flask.sessions import SessionInterface, SessionMixin


class SqliteSession(MutableMapping, SessionMixin):

    _create_sql = (
            'CREATE TABLE IF NOT EXISTS session '
            '('
            '  key TEXT PRIMARY KEY,'
            '  val BLOB'
            ')'
            )
    _get_sql = 'SELECT val FROM session WHERE key = ?'
    _set_sql = 'REPLACE INTO session (key, val) VALUES (?, ?)'
    _del_sql = 'DELETE FROM session WHERE key = ?'
    _ite_sql = 'SELECT key FROM session'
    _len_sql = 'SELECT COUNT(*) FROM session'

    def __init__(self, directory, sid, *args, **kwargs):
        self.path = os.path.join(directory, sid)
        self.directory = directory
        self.sid = sid
        self.modified = False
        self.conn = None
        if not os.path.exists(self.path):
            with self._get_conn() as conn:
                conn.execute(self._create_sql)
                self.new = True

    def __getitem__(self, key):
        key = dumps(key, 0)
        rv = None
        with self._get_conn() as conn:
            for row in conn.execute(self._get_sql, (key,)):
                rv = loads(str(row[0]))
                break
        if rv is None:
            raise KeyError('Key not in this session')
        return rv

    def __setitem__(self, key, value):
        key = dumps(key, 0)
        value = buffer(dumps(value, 2))
        with self._get_conn() as conn:
            conn.execute(self._set_sql, (key, value))
        self.modified = True

    def __delitem__(self, key):
        key = dumps(key, 0)
        with self._get_conn() as conn:
            conn.execute(self._del_sql, (key,))
        self.modified = True

    def __iter__(self):
        with self._get_conn() as conn:
            for row in conn.execute(self._ite_sql):
                yield loads(str(row[0]))

    def __len__(self):
        with self._get_conn() as conn:
            for row in conn.execute(self._len_sql):
                return row[0]

    def _get_conn(self):
        if not self.conn: 
            sys.stderr.write(str(self.path))
            self.conn = sqlite3.Connection(self.path)
        return self.conn

    # These proxy classes are needed in order
    # for this session implementation to work properly. 
    # That is because sometimes flask will chain method calls
    # with session'setdefault' calls. 
    # Eg: session.setdefault('_flashes', []).append(1)
    # With these proxies, the changes made by chained
    # method calls will be persisted back to the sqlite
    # database.
    class CallableAttributeProxy(object):
        def __init__(self, session, key, obj, attr):
            self.session = session
            self.key = key
            self.obj = obj
            self.attr = attr
        def __call__(self, *args, **kwargs):
            rv = self.attr(*args, **kwargs)
            self.session[self.key] = self.obj
            return rv

    class PersistedObjectProxy(object):
        def __init__(self, session, key, obj):
            self.session = session
            self.key = key
            self.obj = obj
        def __getattr__(self, name):
            attr = getattr(self.obj, name)
            if callable(attr):
                return SqliteSession.CallableAttributeProxy(
            self.session, self.key, self.obj, attr)
            return attr

    def setdefault(self, key, value):
        if key not in self:
            self[key] = value
            self.modified = True
        return SqliteSession.PersistedObjectProxy(
            self, key, self[key])


class SqliteSessionInterface(SessionInterface):

    def __init__(self, directory):
        directory = os.path.abspath(directory)
        if not os.path.exists(directory):
            os.mkdir(directory)
        self.directory = directory

    def open_session(self, app, request):
        sid = request.cookies.get(app.session_cookie_name)
        if not sid:
            sid = str(uuid4())
        rv = SqliteSession(self.directory, sid)
        return rv

    def save_session(self, app, session, response):
        domain = self.get_cookie_domain(app)
        if not session:
            try:
                os.unlink(session.path)
            except OSError, e:
                if e.errno != errno.ENOENT:
                    raise
            if session.modified:
                response.delete_cookie(app.session_cookie_name,
                        domain=domain)
            return
        cookie_exp = self.get_expiration_time(app, session)
        response.set_cookie(app.session_cookie_name, session.sid,
                expires=cookie_exp, httponly=True, domain=domain)

Here is how it's used in the main script:

path = '/tmp/app_session'                     
if not os.path.exists(path):
    os.mkdir(path)
    os.chmod(path, int('700', 8))
app.session_interface = SqliteSessionInterface(path)

I suspect (but I have no proof) that your local environment is running one process where PythonAnywhere is running several (one for each worker) and that there's a race in the creation of the session databases at startup. I still can't identify the race but I'm pretty sure it's there. Do you really need server-side sessions? If you're not storing large amounts of data for a session you might be able to just store it in a cookie.

Yes, I need the server side session, I was storing it in a cookie before but it became a problem with one of the data structures I need to store in session.

Also, this was working on PyAny a few weeks ago, so I'm not sure if something else changed.

Did you upgrade your account to add more web workers, perhaps? That might make the race condition Glenn suspects is there more likely to happen.

No, I don't know how to increase workers. Is that a config I can try changing?

It's an account setting -- basically, if you pay more then you can get extra worker processes, which makes your web app faster when you have lots of users on it. But it also means that if you have errors in the code that only show up when there are multiple processes, the errors are more likely to happen. Did you recently upgrade, say, from a free account to a paid one, or from a cheap account to a more expensive one?

No, I've had the same account for months.

Is there a way for me to force it to be one worker to test if this is the problem?

I've changed it on our side so that if you reload it, it will come back with one worker. Let me know if/when you've tested it and you want me to undo it.

No, that didn't work, still got the same error.

RuntimeWarning: tp_compare didn't return -1 or -2 for exception
2015-05-26 13:11:34,031 :  return _active[_get_ident()]
2015-05-26 13:11:34,032 :Traceback (most recent call last):
2015-05-26 13:11:34,032 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2015-05-26 13:11:34,032 :    self.error_log_file.logger.exception("Error running WSGI application")
2015-05-26 13:11:34,032 :  File "/usr/lib/python2.7/logging/__init__.py", line 1185, in exception
2015-05-26 13:11:34,032 :    self.error(msg, *args, **kwargs)
2015-05-26 13:11:34,032 :  File "/usr/lib/python2.7/logging/__init__.py", line 1178, in error
2015-05-26 13:11:34,032 :    self._log(ERROR, msg, args, **kwargs)
2015-05-26 13:11:34,032 :  File "/usr/lib/python2.7/logging/__init__.py", line 1270, in _log
2015-05-26 13:11:34,033 :    record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
2015-05-26 13:11:34,033 :  File "/usr/lib/python2.7/logging/__init__.py", line 1244, in makeRecord
2015-05-26 13:11:34,033 :    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
2015-05-26 13:11:34,033 :  File "/usr/lib/python2.7/logging/__init__.py", line 284, in __init__
2015-05-26 13:11:34,033 :    self.threadName = threading.current_thread().name
2015-05-26 13:11:34,033 :  File "/usr/lib/python2.7/threading.py", line 1160, in currentThread
2015-05-26 13:11:34,034 :    return _active[_get_ident()]
2015-05-26 13:11:34,034 :  File "/bin/user_wsgi_wrapper.py", line 122, in __call__
2015-05-26 13:11:34,034 :    app_iterator = self.app(environ, start_response)
2015-05-26 13:11:34,034 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
2015-05-26 13:11:34,039 :    return self.wsgi_app(environ, start_response)
2015-05-26 13:11:34,040 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 1813, in wsgi_app
2015-05-26 13:11:34,040 :    ctx.push()
2015-05-26 13:11:34,040 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/ctx.py", line 321, in push
2015-05-26 13:11:34,043 :    self.session = self.app.open_session(self.request)
2015-05-26 13:11:34,043 :  File "/home/mritchie712/.local/lib/python2.7/site-packages/flask/app.py", line 825, in open_session
2015-05-26 13:11:34,044 :    return self.session_interface.open_session(self, request)
2015-05-26 13:11:34,044 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 131, in open_session
2015-05-26 13:11:34,045 :    rv = SqliteSession(self.directory, sid)
2015-05-26 13:11:34,045 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 34, in __init__
2015-05-26 13:11:34,046 :    with self._get_conn() as conn:
2015-05-26 13:11:34,046 :  File "/home/mritchie712/gatherMVP/sqliteSession.py", line 77, in _get_conn
2015-05-26 13:11:34,046 :    self.conn = sqlite3.Connection(self.path)
2015-05-26 13:11:34,046 :sqlite3.OperationalError: unable to open database file

Do you still have those print statements Glenn asked you to put in the sqliteSession.py file earlier? It would be interesting to know if it's printing anything different now.

Yes, here it is

2015-05-26 13:11:34,031 :##########1 PRINT OUT START##########/tmp/app_session/35e022ef-9dea-4aee-9551-0be466ee479d##########1 PRINT OUT END####################2 PRINT OUT START##########/tmp/app_session/35e022ef-9dea-4aee-9551-0be466ee479d##########2 PRINT OUT END####################1 PRINT OUT START##########/tmp/app_session/.eJx1VFtvozgY_SsWr0vbQEKSVhpp09B2ug3kRpLCaIUcMMTBF2KbNGTU_z52OjPbedgHJPxdjs85_uzvVloIJHfWnRINsq0U59bddwtsrTsr8LNe4senIApO4flxP_WDXnCuTomf0GC_pnE074VReU5o_MV6t61MiiJVvELsP4inkARRUsWb2Eue5l5Mw128j3tJNG8Tv3JDPyTJZkHCfdCd-is33Dx7cfnlAldoANYQYlsEsypABhRRiMkozzVlqeGpwCrbYTRw3L9Lk7rOOLV0KxZShZAiQwFnO4iIiXJBoVIo_zMDFh8guoLA322fgjyDCvOLqIw3TIn24zc3dY00XNlH05NAUCEB7rlUnIGRXppsjTPVCLQSRNfslKrl3c0NRTmG1wRnOTOsb2gtzHe66aRrL5VXr3JAs7fotue18rW7uZqvhPsCd7e9Q9t7vJ9czRcD57ge5S2uWTpjbX8QPU3p9Ng5vyzmUbXvenj-ik9aQM0lNgKkoa0PSEHNw7GtIyQN0sFvRgytIbvoMgPgOG7XtjDLG3lRa91DVmFWWr-VmgDgBRhRJHAGdULis0k4HbvTcf4CiNaEt0jj25bCWYWE6RqNzbKtTeWs2Wr1YPxza-2T2brneE7XGbquXspxIwRi6tdwSgWF8rXDhiflTOmx7dtWi6AGdztOV2PIhlJ44bxUQpeWLYAsByMGSat5SIBOKGsUPiKg5wEEXKgSlghMuJQg0D6Vl8O-vtBWxBBdIoZ16RpnCMz05OFcc7I_QT78grTe__2DwjNAbM9bIDk5avvADooc1IJvCaISvGG1A1KXKlAjXhN0bUwww65Hg326SdqAb9Zovt4u16s-Lwe9yKfn9jZXPj6cZaFeNof-uDp0q2VBmxh2HpLleJh-RfrsBg__eOWkCGXKfELHw40vhvk2Wh2j3XJfbafTxeD1sQyLpjnIvH5GG9p5Ljb3ZMbJJpzhpJHJeZ8Omrd-Akf-ppaPk9L100buk-5ViL4u2PiYuEUaOf6Q9ruTfNnkXi095ywP3LJ_PgMfvjQSicv78j_39v0Hd6OHSg.CEKcuA.XNyu_6tDrxfHtEU-NTzX2dZjpLk##########1 PRINT OUT END####################2 PRINT OUT START##########/tmp/app_session/.eJx1VFtvozgY_SsWr0vbQEKSVhpp09B2ug3kRpLCaIUcMMTBF2KbNGTU_z52OjPbedgHJPxdjs85_uzvVloIJHfWnRINsq0U59bddwtsrTsr8LNe4senIApO4flxP_WDXnCuTomf0GC_pnE074VReU5o_MV6t61MiiJVvELsP4inkARRUsWb2Eue5l5Mw128j3tJNG8Tv3JDPyTJZkHCfdCd-is33Dx7cfnlAldoANYQYlsEsypABhRRiMkozzVlqeGpwCrbYTRw3L9Lk7rOOLV0KxZShZAiQwFnO4iIiXJBoVIo_zMDFh8guoLA322fgjyDCvOLqIw3TIn24zc3dY00XNlH05NAUCEB7rlUnIGRXppsjTPVCLQSRNfslKrl3c0NRTmG1wRnOTOsb2gtzHe66aRrL5VXr3JAs7fotue18rW7uZqvhPsCd7e9Q9t7vJ9czRcD57ge5S2uWTpjbX8QPU3p9Ng5vyzmUbXvenj-ik9aQM0lNgKkoa0PSEHNw7GtIyQN0sFvRgytIbvoMgPgOG7XtjDLG3lRa91DVmFWWr-VmgDgBRhRJHAGdULis0k4HbvTcf4CiNaEt0jj25bCWYWE6RqNzbKtTeWs2Wr1YPxza-2T2brneE7XGbquXspxIwRi6tdwSgWF8rXDhiflTOmx7dtWi6AGdztOV2PIhlJ44bxUQpeWLYAsByMGSat5SIBOKGsUPiKg5wEEXKgSlghMuJQg0D6Vl8O-vtBWxBBdIoZ16RpnCMz05OFcc7I_QT78grTe__2DwjNAbM9bIDk5avvADooc1IJvCaISvGG1A1KXKlAjXhN0bUwww65Hg326SdqAb9Zovt4u16s-Lwe9yKfn9jZXPj6cZaFeNof-uDp0q2VBmxh2HpLleJh-RfrsBg__eOWkCGXKfELHw40vhvk2Wh2j3XJfbafTxeD1sQyLpjnIvH5GG9p5Ljb3ZMbJJpzhpJHJeZ8Omrd-Akf-ppaPk9L100buk-5ViL4u2PiYuEUaOf6Q9ruTfNnkXi095ywP3LJ_PgMfvjQSicv78j_39v0Hd6OHSg.CEKcuA.XNyu_6tDrxfHtEU-NTzX2dZjpLk##########2 PRINT OUT END##########/usr/lib/python2.7/threading.py:1160: RuntimeWarning: tp_compare didn't return -1 or -2 for exception

random thought- I noticed that you are using your own version of flask in ~/.local. Did you intentionally do this using pip install --user? It might help isolate the problem if you put everything into a virtualenv. (then for example you could even try to monkeypatch the _active[_get_ident()] line in threading.py at line 1160 to print the error in more detail there etc)

Yes, I needed to use Flask 0.10.1, so I have a requirements.txt (contents below) file that I'm running before launching the app

I think I see what you're saying, but I don't understand how I would get it to print out more details about the error (since I'm pretty lost on what's causing the error).

Flask==0.10.1
Flask-Bootstrap==3.3.0.1
Flask-Login==0.2.11
Flask-Mail==0.9.1
Flask-OpenID==1.2.4
Flask-SQLAlchemy==2.0
Flask-Table==0.2.8
Flask-Uploads==0.1.3
Flask-OAuthlib==0.8.0
Flask-WTF == 0.9.5
Flask-SSLify == 0.1.5
pyzipcode==0.4

So the first thing to try is just to switch to using a virtualenv. run something like:

mkvirtualenv MyFlaskApp
pip install -r requirements.txt

And then set your virtualenv in the webapps tab (in this example, it would be /home/mritchie712/.virtualenvs/MyFlaskApp)

And perhaps that may already solve your problem (eg: if there is some conflict with the globally installed version vs the version that you had installed, and the global version was leaking through somehow)

So try this first and see what happens.