Building thread-safe sqlite3 with Python 2.6.5rc1

Hi, I'm trying to get the thread-safe enabled for sqlite3 in my build of 2.6.5rc1, but its not taking and throws the old thread access error. I am running Ubuntu with other versions of Python, but I successfully built and installed sqlite 3.6.22, pysqlite 2.6.0. Do I have to set something explicit when building python 2.6.5 to find the updated sqlite3? thanks for any tips. Darren

Thanks. It says. sqlite: found /usr/local/include/sqlite3.h /usr/local/include/sqlite3.h: version 3.6.22 Which is correct. Yet when I run my progam using the newly built python executable and attempt to use sqlite3 functionality across threads it still says: ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1217128768 and this is thread id -1218753680 I set the -DSQLITE_THREADSAFE=1 flag on sqlite3 when I configured, built and installed the lib. Darren On Mon, 2010-03-08 at 22:52 +0100, "Martin v. Löwis" wrote:
thanks for any tips.
Set sqlite_setup_debug to True in setup.py
Regards, Martin

Which is correct. Yet when I run my progam using the newly built python executable and attempt to use sqlite3 functionality across threads it still says:
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1217128768 and this is thread id -1218753680
I set the -DSQLITE_THREADSAFE=1 flag on sqlite3 when I configured, built and installed the lib.
So you'll need to run Python in a debugger, trying to find out under what conditions the exception is raised. This kind of question is off-topic for python-dev (which is about development of Python, not about using it). Regards, Martin

On Mon, Mar 08, 2010 at 05:28:10PM -0500, Darren Govoni wrote:
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1217128768 and this is thread id -1218753680
Darren, try to pass check_same_thread=False when creating a connection. Oleg. -- Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.

That worked great Oleg! Thank you! On Tue, 2010-03-09 at 01:52 +0300, Oleg Broytman wrote:
On Mon, Mar 08, 2010 at 05:28:10PM -0500, Darren Govoni wrote:
ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1217128768 and this is thread id -1218753680
Darren, try to pass check_same_thread=False when creating a connection.
Oleg.
participants (3)
-
"Martin v. Löwis"
-
Darren Govoni
-
Oleg Broytman