473,387 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 2790
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
7
by: Jan Gregor | last post by:
Hello I found that jython catches exact java exceptions, not their subclasses. Is there some way to get around this limitation (or error) ? My program has class representing database source...
5
by: Maurice Ling | last post by:
Hi, I have read that this had been asked before but there's no satisfactory replies then. I have a module (pA) written in python, which originally is called by another python module (pB), and...
1
by: Nandan | last post by:
hello, can I ask a jython question here? when I use the jython interpreter I have no problem with the statement: from java import lang from javax import swing but when I put this in a...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
1
by: Mark Fink | last post by:
Hi there, I have a source file FailFixture.py in the folder D:\AUT_TEST\workspace\JyFIT\testutil. Now I want to import the file with "import testutil.FailFixture". Unfortunately I could not...
1
by: Gregor Stich | last post by:
Dear all, I hope my question is here in the right place... What I want to achieve is a communication between Java and Python. We have a pretty strong framework of existing python scripts and...
3
by: nmin | last post by:
Hi, I'm using Jython in combination with java. I wrote a jython skript, which calls a function from another jython module called library.py. So, executing the function genData() in skript...
2
by: Felipe De Bene | last post by:
Hi There, I'm trying to run an App I wrote in Python 2.5.2 in Jython 2.2.1 and everything works fine except when I try to import the Standard CPython's cookielib. I know this may sound stupid, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.