Jython - problem import os

nmin at freenet.de nmin at freenet.de
Wed Aug 8 08:10:29 EDT 2007


Hi.

I'm using Jython in combination with Java, webservices and jboss4.0.4.

The webservice is implemented in java and creates an PythonInterpreter
object which loads the jython scripts.
I wrote an jython script which uses a function from another jython
file called library.py.

So, i wrote:

service.java
========

public void webMethod(){
PythonInterpreter p = new PythonInterpreter()

p.execfile(skript.py)
}

skript.py
======
from library import *

test=testFunction()

library.py
=======

import os

def testFunction():
    os.getcwd()


...all these files are inside my ear-archive and the service.java
represent my webservice class.
So, calling WebMethod returns:

ImportError: no module named javaos in library.py.

Any ideas?




More information about the Python-list mailing list