Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Loading…'s builtin server, DBUtils & sqlite fail #147

ghost opened this Issue · 0 comments

1 participant


I've noticed that unless I disable pooling, the second request using a sqlite server (created with web.database) fails.

Disabling pooling is fine for me, and I don't use the builtin server in production but still... thought it worth reporting?

I believe the following 'should' reproduce this:

import web
    '/url', 'Url',
APP = web.application(MAPPING, globals(), autoreload=False)
db = web.database(dbn='sqlite', db='foo.db')
class Url:
    def GET(self):
        bar = db.query("""SELECT * FROM baz""")

And here's the traceback:

Traceback (most recent call last):
  File "C:\Python24\lib\site-packages\web\", line 237, in process
    return self.handle()
  File "C:\Python24\lib\site-packages\web\", line 228, in handle
    return self._delegate(fn, self.fvars, args)
  File "C:\Python24\lib\site-packages\web\", line 409, in _delegate
    return handle_class(cls)
  File "C:\Python24\lib\site-packages\web\", line 385, in handle_class
    return tocall(*args)
  File "C:\Documents and Settings\JPC\workspace\foo\", line 36, in GET
    bar= db.query("""SELECT * FROM baz
  File "C:\Python24\lib\site-packages\web\", line 1029, in query
    out = DB.query(self, *a, **kw)
  File "C:\Python24\lib\site-packages\web\", line 643, in query
    db_cursor = self._db_cursor()
  File "C:\Python24\lib\site-packages\web\", line 566, in _db_cursor
    return self.ctx.db.cursor()
  File "c:\python24\lib\site-packages\dbutils-1.1-py2.4.egg\DBUtils\", line 470, in cursor
    return SteadyDBCursor(self, *args, **kwargs)
  File "c:\python24\lib\site-packages\dbutils-1.1-py2.4.egg\DBUtils\", line 493, in __init__
    self._cursor = con._cursor(*args, **kwargs)
  File "c:\python24\lib\site-packages\dbutils-1.1-py2.4.egg\DBUtils\", line 442, in _cursor
    cursor = self._con.cursor(*args, **kwargs) # try to get a cursor
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 6108 and this is thread id 4124
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.