[pylucene-dev] installation on amazon ec2

Ashmir Dhrolia ashmir at ebooks.com
Sun Sep 7 20:49:59 PDT 2008


Hi
I am trying to install Pylucene on an Amazon EC2 instance of Fedora Core 
4. I downloaded the pylucene-2.3.1 binaries and placed them in the local 
python site packages directory. When I try to run the following code, I 
get a
"ImportError: libjava.so: cannot open shared object file: No such file 
or directory"

<code>
#!/usr/bin/python
import sys
import string
from lucene import *

def main():
        #1. Create the index
        index = RAMDirectory()
        analyzer = StandardAnalyzer()
        w = IndexWriter(index, analyzer, true)
        addDoc(w, "Lucene in Action")
        addDoc(w, "Lucene for Dummies")
        addDoc(w, "Managing Gigabytes")
        addDoc(w, "The Art of Computer Science")
        w.close()

        #2. query
        if len(sys.argv) > 0:
                querystr = argv[0]
        else:
                querystr = "lucene"
        ana = StandardAnalyzer()
        q = QueryParser("title", ana).parse(querystr)

        #3. search
        s = IndexSearcher(index)
        hits = s.search(q)

        #4. display results
        print "Found " + len(hits) + " hits."
        for i in range(len(hits)):
                print i+1 + ". " + hits.doc(i).get("title")
        s.close()


def addDoc(w, value):
    doc = Document()
    field = Field("title", value, Field.Store.YES, Field.Index.TOKENIZED)
    doc.add(field)
    w.addDocument(doc)


if __name__ == "__main__":
  main()
</code>

Where can I find this libjava.so file? Or have I done the setup incorrectly?
Thanks,
Ashmir



More information about the pylucene-dev mailing list