Jython - problem import os

N

nmin

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?
 
N

nmin

Thats it ...

Additionally I had to set the python path with sys.path.append to the
Lib folder .. and now it works perfect.

thanks a lot

Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top