0

I have been developing a Python program using the Pydev(2.5.0) plugin in Eclipse Helios on Ubuntu OS 11.4.

The program uses lucene (core 3.6) library. Lucene was installed using jcc. Previously I developed it with a text editor and ran on the command line using python xxx.py and there was no problem regarding lucene libraries.

Then, I imported the project to Eclipse IDE. The other source files still run as-is, but the program cannot locate the basic classes of lucene library.

import lucene # no error

but if I try to import StandardAnalyzer or any other class, I get an error:

from lucene import StandardAnalyzer  #error:  unresolved import

My configuration:

  • Grammer Version: 2.7

  • Python interpreters: usr/bin/python2.7

Libraries include:

Pythonpath libraries

I tried the add the lucene folder to the external libraries but it didn't help. I have found this path by using command line python interpreter with these commands.

import lucene
print lucene.__path__

Though a similar path is already in the library (see image. 2nd library)

['/usr/local/lib/python2.7/dist-packages/lucene-3.6.0-py2.7-linux-i686.egg/lucene']

I would appreciate your comments about this problem. Thanks.

AndyG
  • 39,700
  • 8
  • 109
  • 143
isilpekel
  • 121
  • 1
  • 8

2 Answers2

1

I think that the problem is that the PyDev code-analyzer can't really analyze PyLucene. You can try adding 'lucene' to window > preferences > pydev > interpreter - python > forced builtins (see: http://pydev.org/manual_101_interpreter.html for details).

Fabio Zadrozny
  • 24,814
  • 4
  • 66
  • 78
1

Had the same problem running Helios Service Release 2 on Mac OSX 10.8.5. Fixed it as follows:

  1. Open Project >> Properties

    • Select PyDev - Interpreter/Grammar
    • Click "Click here to configure an interpreter not listed"
    • Select your interpreter
  2. Select "Forced Builtins" and add all three directories (lucene, org and java) (see http://pydev.org/manual_101_interpreter.html for details).

  3. Select "Libraries" and add the path to each of those directories to System libs.
al.stevens
  • 71
  • 2