472,125 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,125 software developers and data experts.

Jython - problem import os

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?

Aug 8 '07 #1
1 2703
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

Aug 14 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by angel | last post: by
7 posts views Thread by Jan Gregor | last post: by
1 post views Thread by Nandan | last post: by
12 posts views Thread by Mark Fink | last post: by
1 post views Thread by Mark Fink | last post: by
1 post views Thread by Gregor Stich | last post: by
3 posts views Thread by nmin | last post: by
2 posts views Thread by Felipe De Bene | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.