By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,907 Members | 1,832 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,907 IT Pros & Developers. It's quick & easy.

Pyro and sqlite3 problem

P: n/a

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
Dec 1 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Off hand -- ensure that each remote access runs the entire sequence
of "connect, cursor, execute, fetch, cursor-close, connection-close"
rather than trying to, say, create a cursor in one access and then use
that cursor on a second access...

Or maybe create one long-running thread to handle the database
access and use queue objects to transfer the remote access parameters to
the database thread, then retrieve from a return queue.
--
thanks you for answer.
Do you think the first solution will be slow? I think I must use
locking to avoid problem.

The second solution seems better and looks like what I wanted to build
at first time, but maybe an ever opened sqlite database isn't a good
thing ?
Dec 2 '07 #2

P: n/a
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 <se************@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
<se**************@gmail.comwrote:
>
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

Dec 2 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.