On Wed, 2006-12-27 at 11:12 -0800, Andi Vajda wrote: > 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 interesting question is: why did it work with my previous deb i built with gcj 4.1 (the one where highlighter didn't work)? Django didn't crush and pylucene worked inside it... > > 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. what is the exact thing that needs changing.. i can't seem to find "import Thread", but a lot of "import threading" in django... bye andraz _______________________________________________ pylucene-dev mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
