<class 'sqlalchemy.exc.ProgrammingError'>
Python 2.5.2: /usr/local/bin/python
Sat Mar 13 22:18:47 2010

A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.

 /usr/local/lib/python2.5/site-packages/flup-1.0-py2.5.egg/flup/server/fcgi_base.py in run(self=<flup.server.fcgi_base.Request object at 0x89dca6c>)
  556         """Runs the handler, flushes the streams, and ends the request."""
  557         try:
  558             protocolStatus, appStatus = self.server.handler(self)
  559         except:
  560             traceback.print_exc(file=self.stderr)
protocolStatus undefined, appStatus undefined, self = <flup.server.fcgi_base.Request object at 0x89dca6c>, self.server = <flup.server.fcgi.WSGIServer object at 0x827658c>, self.server.handler = <bound method WSGIServer.handler of <flup.server.fcgi.WSGIServer object at 0x827658c>>
 /usr/local/lib/python2.5/site-packages/flup-1.0-py2.5.egg/flup/server/fcgi_base.py in handler(self=<flup.server.fcgi.WSGIServer object at 0x827658c>, req=<flup.server.fcgi_base.Request object at 0x89dca6c>)
 1114         try:
 1115             try:
 1116                 result = self.application(environ, start_response)
 1117                 try:
 1118                     for data in result:
result = None, self = <flup.server.fcgi.WSGIServer object at 0x827658c>, self.application = <__main__.LighttpdFix object at 0x827646c>, environ = {'DOCUMENT_ROOT': '/usr/local/www/rangaku.org', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'close', 'HTTP_HOST': 'www.rangaku.org', 'HTTP_PRAGMA': 'no-cache', ...}, start_response = <function start_response at 0x8f4464c>
 /usr/local/www/rangaku.org/fcgi_frontend.py in __call__(self=<__main__.LighttpdFix object at 0x827646c>, environ={'DOCUMENT_ROOT': '/usr/local/www/rangaku.org', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'close', 'HTTP_HOST': 'www.rangaku.org', 'HTTP_PRAGMA': 'no-cache', ...}, start_response=<function start_response at 0x8f4464c>)
   19                                environ.get('PATH_INFO', '')
   20         environ['SCRIPT_NAME'] = ''
   21         return self.app(environ, start_response)
   22 
   23 if __name__ == '__main__':
self = <__main__.LighttpdFix object at 0x827646c>, self.app = <function app at 0x8656c6c>, environ = {'DOCUMENT_ROOT': '/usr/local/www/rangaku.org', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'close', 'HTTP_HOST': 'www.rangaku.org', 'HTTP_PRAGMA': 'no-cache', ...}, start_response = <function start_response at 0x8f4464c>
 /usr/local/www/rangaku.org/kouyou/application.py in app(environ={'DOCUMENT_ROOT': '/usr/local/www/rangaku.org', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,text/xml;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'no-cache', 'HTTP_CONNECTION': 'close', 'HTTP_HOST': 'www.rangaku.org', 'HTTP_PRAGMA': 'no-cache', ...}, start_reponse=<function start_response at 0x8f4464c>)
   63         endpoint, values = url_adapter.match()
   64         view = import_string('kouyou.' + endpoint)
   65         resp = view(req, **values)
   66     except (HTTPException, RequestRedirect), e:
   67         resp = e
resp undefined, view = <function browse_index at 0x8dfa7d4>, req = <kouyou.application.Request object at 0x972e56c>, values = {}
 /usr/local/www/rangaku.org/kouyou/dictionary.py in browse_index(request=<kouyou.application.Request object at 0x972e56c>)
   57     c = schema.engine.connect()
   58     query = select([func.count(schema.entries.c.headword)])
   59     count = c.execute(query).scalar()
   60     limit = 10
   61     pages = count / limit
count undefined, c = <sqlalchemy.engine.base.Connection object at 0x8e1842c>, c.execute = <bound method Connection.execute of <sqlalchemy.engine.base.Connection object at 0x8e1842c>>, query = <sqlalchemy.sql.expression.Select at 0x8e1848c; Select object>, ).scalar = <bound method Select.scalar of <sqlalchemy.sql.expression.Select at 0x8e1848c; Select object>>
 /usr/local/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/sqlalchemy/engine/base.py in execute(self=<sqlalchemy.engine.base.Connection object at 0x8e1842c>, object=<sqlalchemy.sql.expression.Select at 0x8e1848c; Select object>, *multiparams=(), **params={})
  822         for c in type(object).__mro__:
  823             if c in Connection.executors:
  824                 return Connection.executors[c](self, object, multiparams, params)
  825         else:
  826             raise exc.InvalidRequestError("Unexecutable object type: " + str(type(object)))
global Connection = <class 'sqlalchemy.engine.base.Connection'>, Connection.executors = {<type 'basestring'>: <function _execute_text at 0x883aed4>, <class 'sqlalchemy.sql.expression.ClauseElement'>: <function _execute_clauseelement at 0x883ae64>, <class 'sqlalchemy.sql.expression.Function'>: <function _execute_function at 0x883adf4>, <class 'sqlalchemy.schema.SchemaItem'>: <function _execute_default at 0x883ae2c>, <class 'sqlalchemy.schema.DDL'>: <function _execute_ddl at 0x883af44>, <class 'sqlalchemy.engine.base.Compiled'>: <function _execute_compiled at 0x883ae9c>}, c = <class 'sqlalchemy.sql.expression.ClauseElement'>, self = <sqlalchemy.engine.base.Connection object at 0x8e1842c>, object = <sqlalchemy.sql.expression.Select at 0x8e1848c; Select object>, multiparams = (), params = {}
 /usr/local/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/sqlalchemy/engine/base.py in _execute_clauseelement(self=<sqlalchemy.engine.base.Connection object at 0x8e1842c>, elem=<sqlalchemy.sql.expression.Select at 0x8e1848c; Select object>, multiparams=(), params=[])
  872                         parameters=params
  873                     )
  874         return self.__execute_context(context)
  875 
  876     def _execute_compiled(self, compiled, multiparams, params):
self = <sqlalchemy.engine.base.Connection object at 0x8e1842c>, self.__execute_context undefined, context = <sqlalchemy.databases.sqlite.SQLiteExecutionContext object at 0x8e183ec>
 /usr/local/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/sqlalchemy/engine/base.py in __execute_context(self=<sqlalchemy.engine.base.Connection object at 0x8e1842c>, context=<sqlalchemy.databases.sqlite.SQLiteExecutionContext object at 0x8e183ec>)
  894             self._cursor_executemany(context.cursor, context.statement, context.parameters, context=context)
  895         else:
  896             self._cursor_execute(context.cursor, context.statement, context.parameters[0], context=context)
  897         if context.compiled:
  898             context.post_exec()
self = <sqlalchemy.engine.base.Connection object at 0x8e1842c>, self._cursor_execute = <bound method Connection._cursor_execute of <sqlalchemy.engine.base.Connection object at 0x8e1842c>>, context = <sqlalchemy.databases.sqlite.SQLiteExecutionContext object at 0x8e183ec>, context.cursor = <sqlalchemy.pool._CursorFairy object at 0x8e1866c>, context.statement = u'SELECT count(entries.headword) AS count_1 \nFROM entries', context.parameters = [[]]
 /usr/local/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/sqlalchemy/engine/base.py in _cursor_execute(self=<sqlalchemy.engine.base.Connection object at 0x8e1842c>, cursor=<sqlalchemy.pool._CursorFairy object at 0x8e1866c>, statement=u'SELECT count(entries.headword) AS count_1 \nFROM entries', parameters=[], context=<sqlalchemy.databases.sqlite.SQLiteExecutionContext object at 0x8e183ec>)
  948             self.dialect.do_execute(cursor, statement, parameters, context=context)
  949         except Exception, e:
  950             self._handle_dbapi_exception(e, statement, parameters, cursor, context)
  951             raise
  952 
self = <sqlalchemy.engine.base.Connection object at 0x8e1842c>, self._handle_dbapi_exception = <bound method Connection._handle_dbapi_exception...hemy.engine.base.Connection object at 0x8e1842c>>, e = ProgrammingError('library routine called out of sequence',), statement = u'SELECT count(entries.headword) AS count_1 \nFROM entries', parameters = [], cursor = <sqlalchemy.pool._CursorFairy object at 0x8e1866c>, context = <sqlalchemy.databases.sqlite.SQLiteExecutionContext object at 0x8e183ec>
 /usr/local/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/sqlalchemy/engine/base.py in _handle_dbapi_exception(self=<sqlalchemy.engine.base.Connection object at 0x8e1842c>, e=ProgrammingError('library routine called out of sequence',), statement=u'SELECT count(entries.headword) AS count_1 \nFROM entries', parameters=[], cursor=<sqlalchemy.pool._CursorFairy object at 0x8e1866c>, context=<sqlalchemy.databases.sqlite.SQLiteExecutionContext object at 0x8e183ec>)
  929                 if self.__close_with_result:
  930                     self.close()
  931             raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect)
  932         finally:
  933             del self._reentrant_error
global exc = <module 'sqlalchemy.exc' from '/usr/local/lib/py...s/SQLAlchemy-0.5.1-py2.5.egg/sqlalchemy/exc.pyc'>, exc.DBAPIError = <class 'sqlalchemy.exc.DBAPIError'>, exc.DBAPIError.instance = <bound method type.instance of <class 'sqlalchemy.exc.DBAPIError'>>, statement = u'SELECT count(entries.headword) AS count_1 \nFROM entries', parameters = [], e = ProgrammingError('library routine called out of sequence',), connection_invalidated undefined, is_disconnect = False

<class 'sqlalchemy.exc.ProgrammingError'>: (ProgrammingError) library routine called out of sequence u'SELECT count(entries.headword) AS count_1 \nFROM entries' []
      args = ('(ProgrammingError) library routine called out of sequence',)
      connection_invalidated = False
      instance = <bound method type.instance of <class 'sqlalchemy.exc.ProgrammingError'>>
      message = '(ProgrammingError) library routine called out of sequence'
      orig = ProgrammingError('library routine called out of sequence',)
      params = []
      statement = u'SELECT count(entries.headword) AS count_1 \nFROM entries'