Pyro and sqlite3 problem

Sébastien Ramage sebastien.ramage at gmail.com
Sun Dec 2 13:21:15 EST 2007


I'm trying to build a client/server app
the server use a sqlite3 database to store differents things
the client ask the server to get value or store new entries in the
database.
The problem is that Pyro create a new thread for each client

at first time I create the connection to database at server start and
I would re use the connection for transaction but I get the error.
Maybe I can open/close database for each transaction but maybe it
would be slow ?

Seb


2007/12/1, Sergio Correia <sergio.correia at gmail.com>:

    If you are creating a cursor/connection object, you need to use it
in
    the same thread that created it. Otherwise, some weird errors can
    happen (as many of this list have said).

    If you give us more info about the type of the problem (what are
you
    trying to do?) we can help you build a safer app.

    Best,
    Sergio

    PS: When faced with the same error, I just recycled the objects
used
    in the I/O operations and the problem was solved. However, that
was
    done locally, without using Pyro, so your milleage may vary.

    On Dec 1, 2007 4:29 AM, Sébastien Ramage
<sebastien.ramage at gmail.com> wrote:
    >
    > Hi !
    >
    > I'm trying to build an client/server app based on Pyro and
sqlite3.
    > But I have a problem using sqlite3 on the server
    >
    > I got this error :
    >
    > sqlite3.ProgrammingError: ('SQLite objects created in a thread
can
    > only be used
    > in that same thread.The object was created in thread id 240 and
this
    > is thread i
    > d 4068', 'This error occured remotely (Pyro). Remote traceback
is
    > available.')
    >
    > what can I do to avoid this ?
    >
    > I'm using Python 2.5.1,Pyro 3.7  under Windows
    >
    > Sébastien
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >





More information about the Python-list mailing list