I am using the GitPython package to access the Git repository from Python. This pulls out the async packet. In async/__init__.py the following happens:
def _init_signals(): """Assure we shutdown our threads correctly when being interrupted""" import signal
This works great if everything is in the main thread. However, when the first import of git (and therefore async ) occurs in another thread, everything goes as an arrow:
ValueError: signal only works in main thread
Since all this is done inside the Django framework, I do not control the threads.
The workaround I found is to put import async in settings.py , which is (apparently) imported into the main stream. However, this must be done for each installation, so it is not very pleasant for users of my Django application.
I tried to catch the exception, but the import that caused the exception was not completely completed, so the next import async does not work either.
Can you think of any suitable working method / hack this problem?
Update: I noticed that Apache mod_wsgi is smart enough to ignore the signal call:
[Tue Sep 07 19:53:11 2010] [warn] mod_wsgi (pid=28595): Callback registration for signal 2 ignored.
The problem remains with the Django development server.
source share