Standalone Jython: import error (Apache-POI)

Jython standalone jar throws an ImportError exception while I'm trying to use Jython with Apache-POI.

Below you will find out what I call my Jython script:

java -cp C:\jAutoMailerScript\lib\poi-3.9-20121203.jar -jar jython.jar main.py

Error:

Traceback (last last call):

File "main.py", line 32, in

from org.apache.poi.hssf.usermodel import *

ImportError: no module named apache

This is the code on line # 32:

from org.apache.poi.hssf.usermodel import *

Is there any restriction from Jython for working with third-party Java applications?

Thanks in advance,

+5
source share
4 answers

-cp -jar . -jar . . http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html.

python.path :

java -Dpython.path=C:\jAutoMailerScript\lib\poi-3.9-20121203.jar -jar jython.jar main.py

:

java -cp C:\jAutoMailerScript\lib\poi-3.9-20121203.jar;jython.jar org.python.util.jython main.py

, Jython . ImportError, . , : http://bugs.jython.org/issue1422 ( , Solaris, ).

Jython jython :

jython -Dpython.path=C:\jAutoMailerScript\lib\poi-3.9-20121203.jar main.py

, jython.jar Python ( Lib). jython.jar, Jython.

, , .

+7

2.5.3 Jython. POI 3.7; . sys.path.append, . - ( - barcode4j):

c:\development\local\lib\jython-sa-2.5.3>java -jar jython-standalone-2.5.3.jar
Jython 2.5.3 (2.5:c56500f08d34+, Aug 13 2012, 14:54:35)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_10
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\development\\local\\lib\\jython-sa-2.5.3\\Lib', 'C:\\development\\local\\lib\\jython-sa-2.5.3\\jython-standalone-2.5.3.jar\\Lib', '__classpath__', '__pyclasspath__/']
>>> sys.path.append('C:\development\local\lib\barcode4j-2.0\build\barcode4j.jar')
>>> sys.path
['', 'C:\\development\\local\\lib\\jython-sa-2.5.3\\Lib', 'C:\\development\\local\\lib\\jython-sa-2.5.3\\jython-standalone-2.5.3.jar\\Lib', '__classpath__', '__pyclasspath__/', 'C:\\development\\local\\lib\x08arcode4j-2.0\x08uild\x08arcode4j.jar']
>>>

, - '\'?

( python.path, , .)

, - /? , ( ) , .

+3

jython 2.5.4-rc1 commons-lang3-3.1.jar .. , !: - (

EDIT: ! Jython Java?

Jython!

java -Dpython.cachedir.skip=false -Dpython.cachedir=/tmp {...}
+3

sys.path.append('C:\jAutoMailerScript\lib\poi-3.9-20121203.jar')

script. os . , jython Windows.

+1

All Articles