On Wed, 27 Dec 2006, Norbert Wojtowicz wrote:

Not sure about that specific problem, but as far as I know, PyLucene will not
work from inside Django. The issue is Django uses python threads and PyLucene
uses PyLucene threads (a small wrapper on top of normal python threads). Even
though they are just a small wrapper, they are incompatible with each other.

PyLucene.PythonThread is a subclass of Python's threading.Thread that delegates the starting of the OS thread to libgcj so that it can set it up with the garbage collector. Internally, there are then two thread instances, one Python, one Java, that wrap the *same* OS thread. Because a PyLucene.PythonThread is a subclass of python's threading.Thread it is fully compatible with regular Python threads and the Python threading APIs.

The problem with running PyLucene in a web framework such as Django is making sure the threads making PyLucene calls are of the right class. I don't know enough about Django to say how this is done but this being python and open source there has got to be a way.

The only solution would be to grep all the 'import Thread' in Django source
code and substitute with 'import PythonThread as Thread' (don't recall
offhand if that's the exact name).

That could work. Others have suggested to simply set threading.Thread to PyLucene.PythonThread. There may also be a way to configure Django without having to resort to such tricks.

Andi..
_______________________________________________
pylucene-dev mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev

Reply via email to