My webapp runs normally as a python script, but cannot import module 
"threading" when run under mod_wsgi. This problem started after I upgraded 
to Python 3.2.3 which evidently no longer allows concurrent connections to 
my SQLite database. Suddenly my module crashed with error:
ProgrammingError: SQLite objects created in a thread can only be used in 
that same thread.The object was created in thread id * and this is thread 
id *

This is a disaster because the only way to recover is to restart Apache, 
surely a Python failing that needs to be fixed.

I attempted to isolate sqlite3 objects with this method:

import threading 
self.local = threading.local() # Thread local storage for db handles

but I am not sure this is the right solution.

This is OSX 10.8 Server.app running mod_wsgi 3.4 under directive:

WSGIDaemonProcess Sectrum python-path=[path] processes=1 threads=1 
display-name=Sectrum

I do have another simpler wsgi script that imports threading without 
complaining, so I suspect the configuration in the previous line overrides 
the default and whacks my webapp. Can anyone explain this? And if possible 
a solution to the sqlite3 concurrency problem?

-- Gnarlie

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/modwsgi/-/wirjTAO-PFkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to