[pylucene-dev] PythonThread

Alexandre Fiori fiorix at gmail.com
Tue Feb 19 06:53:26 PST 2008


Now you just call attachCurrentThread() in the thread's body.
There's an example in samples/ThreadIndexFiles.py, as follows:

import sys, os, threading
from datetime import datetime
from lucene import StandardAnalyzer, VERSION, attachCurrentThread
from IndexFiles import IndexFiles


if __name__ == '__main__':
    if len(sys.argv) < 2:
        print IndexFiles.__doc__
        sys.exit(1)
    print 'lucene', VERSION

    def fn():
        attachCurrentThread()
        start = datetime.now()
        IndexFiles(sys.argv[1], "index", StandardAnalyzer())
        end = datetime.now()
        print end - start

    threading.Thread(target=fn).start()


On Feb 19, 2008 11:04 AM, Johan Jonkers <johan at cq2.nl> wrote:

> Hi,
>
> In our code we use PyLucene's PythonThread class, but I dont see it
> anymore in PyLucene 2.3? Has it been replaced? I cant seem to find any
> documentation on it  either.
>
> - Johan
>
> _______________________________________________
> pylucene-dev mailing list
> pylucene-dev at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/pylucene-dev
>



-- 
Ship ahoy! Hast seen the While Whale?
 - Melville's Captain Ahab
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/pylucene-dev/attachments/20080219/6d913c76/attachment.html


More information about the pylucene-dev mailing list