jython

How can I make the PyDev editor selectively ignore errors?

I'm using PyDev under Eclipse to write some Jython code. I've got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ISubInterface The problem is that PyDev will always flag this as an error and say "Unresolved import: ISubInterface". The code works just fin...

Jython exception handling within loops

Hi, I am using Marathon 2.0b4 to automate tests for an application. A shortcoming of wait_p, one of the script elements provided by Marathon, is that its default timeout is hardcoded to be 60 seconds. I needed a larger timeout due to the long loading times in my application. [I considered patching Marathon, but didn't want to maintain ...

How can I add jars dynamically to jython, inside script?

I am writing a package in python that talks to an ldap server. I want it to work in CPython and Jython. To get it to work with CPython, I have successfully coded against python-ldap. However, to get it working with Jython, I must use a java jar. How can I distribute the jar file with my package, so that if it can "import java", it knows...

Developing Eclipse plugins without Java

Is it possible to create Eclipse plugins/program Eclipse RCP apps without Java? (preferably in Jython) ...

Jython 2.1 __getattr__

I am trying to implement a wrapper/proxy class for a java object (baseClient) in jython v2.1. Everything seems to be working ok except when the following statement is encountered: if __client != None # __client is an instance of the ClientProxy class raise AttributeError(attr) is called in __getattr__(), because self.__baseClient does...

Using Jython From Eclipse Plugin

I am having a tough time getting jython to work properly when run from an Eclipse plugin. I have a simple object factory that loads a python module conforming to a Java Interface. All of this works fine in standalone mode. However, when I package this as an eclipse plugin, I get a different error based on a few variables: Given that ...

How to kill main thread from sub thread in Jython

I have a script that creates a thread which after 60 seconds (this thread) needs to kill the main thread. I`m not sure what command I can use to kill the main thread. I'm using Jython 2.5.1 and Thread.interrupt_main doesn't work. Here is the code: import threading def exitFunct(): #exit code here t = threading.Timer(60.0, exitFunc...

Jython How to stop script from thread?

I'm looking for some exit code that will be run from a thread but will be able to kill the main script. It's in Jython but I can't use java.lang.System.exit() because I still want the Java app I'm in to run, and sys.exit() isn't working. Ideally I would like to output a message then exit. My code uses the threading.Timer function to run...

Alternative to interrupt_main() in Jython?

Whenever the code thread.interrupt_main() is used in Jython it doesn't actually interrupt the main thread. Any ideas as to alternatives? Code is below: import threading import dummy_thread as _thread def exitFunct(): _thread.interrupt_main() t = threading.Timer(60.0, exitFunct) t.start() for i in range(1, 3000): print i ...

What is the easiest way to debug embedded jython in eclipse?

I know I can debug embedded (launched from a Java program) Jython with a remote Pydev debugger. Is there a simpler way to do it? ...

Replace Multiple lines in Jython

Hi Everyone , I have written a small program to replace a set of characters , but i also want two or more replace command in a single program . Apart from it i also want to add an bracket after random set of characters. This is my Program file_read=open('<%=odiRef.getOption("READ")%>/EXPORT.XML','r') file_write=open('<%=odiRef.ge...

What is Jython and is it useful at all?

I know Python. When will I need Jython? What are the drawbacks. I assume it is slow? Please detail it out! thanks. ...

what is the correct command to search for an exact string ,

i have tried startswith , find , re.sub but all seems to be find that string that matches part of it . iam looking for command which searchs the exact string which iam searching for in a given file. Thanks for your help. ...

Data extraction and manipulation in jython

For a given file For ex : 11 ,345 , sdfsfsfs , 1232 i need to such above records from a file , read 11 to delimiter and strip the white space and store in the another file , similarly 345 to delimiter strip the while space and store in the file. This way i need to do for multiple rows. so finally in the other file the data should ...

How to Improve Performance and speed

I have written this program for connecting and fetching the data into file, but this program is so slow in fetching . is there is any way to improve the performance and faster way to load the data into the file . iam targeting around 100,000 to million of records so thats why iam worried about performance and also can i use array fetch s...

Is there a Java Scripting Language that Can Work Without Caching? Jython? Groovy? etc?

Hi all, We have an existing java-based heavyweight project that needed an interactive script interpreter. After a fair amount of research we eventually ended up with Jython, one of the reasons being that the customer's group already has a large amount of python expertise, and it's an easier sell to give them an api in a language c...

Get data back from Jython scripts using JSR-223

Hello. I am using Jython 2.5.1 with JSR-223 (i.e. javax.script package) and I expect the last line of the Python script to be returned. For example, after evaluating this script: class Multiplier: def multiply(self, x, y): return x * y Multiplier().multiply(5, 7) I should get back 35, but I get null instead. In other hand it w...

Help with JYTHON 2.0 CODE -STRING MANIPULATION and replace

As i have already asked this question and i have later realized that tool for which iam writing JYTHON CODES supports presently on till 2.1 version as the intepreter is of 2.1 so some of the advanced technique is not working. Now being a new and excited to learn more in jython so that ican write more better and sma...

How do you get a member of an enum in jython?

enum day{ mon,tue} enum getday(){ return day; } I want to print the day, like "mon" or "tue". Is it possible? ...

number formatting

I have a simple question how can i show the number 12045678 as 12,045,678 i.e automatically show in american format in jython so 12345 should be 12,345 and 1234567890 should be 1,234,567,890 and so on. Thanks everyone for your help. ...