jython

Jython classes and variable scope

What I want to know is, how can I create GUI elements using swing inside a Jython class so that they can be referenced from outside the class, and I can use statements like button.setText("Hello") on an object that was created inside another class. For example: foo.py: from javax.swing import * class Test(): def __init__(self): ...

Integration of Jython and Python

I have a Python application that is running as a console application. I did not like Python GUI libraries. That's why I want to use Java for GUI and python for application core. There are lots of details to read in the Jython documentation. I need a simple way to connect the GUI programmed in Java, and the core programmed in Python. What...

copy lines in range using Python/Jython

Hi all, I have a server log file which is constantly updated. after some script execution, I want to collect the relevant part of my execution from the server log into an execution log. Basically, I need to capture the last line number of my server log before the test started (which I already know how to do), say X, and after executi...

How to quickly fail a python script if it is called from wrong interpreter?

I have inherited a few Python scripts from someone who has left my employer. Some are meant to be run from Jython, others are not. I'd like to add them to svn, but before I do I want to modify these files so that if a "requires Jython" file is run from python, the user gets a message like "please run with Jython" and the program exits....

unable to compile python program using jython

Hi, I'm trying to compile a python program using jython and it's throwing below error C:\jython2.2.1>jython test.py Traceback (innermost last): (no code object) at line 0 File "test.py", line 30 html = html if html else download(url, user_agent).read() ^ SyntaxError: invalid synta...

How do I convert a hexidecimal color (with alpha) to an int in Jython?

Hi, I need to convert an ARGB hex into an int in Jython for color. I've tried using longs, hex() and a combination of other things and can't seem to get it to work. I get this error "TypeError : 5th arg can't be coerced to int" when I try to convert 0x80ff3333 to an int. I guess there are too many bytes in the hex to convert it. Anyon...

Running cx_Oracle under jython on tomcat

Hi I'm trying to load cx_Oracle using tomcat. Loading from python works fine, but for jython I'm getting "module not found". My system.path includes site-packages that contains cx_Oracle.so. I'm new to jython and I've not had time to familiarize myself with all the variables but I believe I have all the necessary environment variables...

Jython - attempting to call functions from JFrame, receiving 'NoneType' error

So I'm playing around with Jython, trying to slap together a generic GUI. Nothing beyond what they have on the Jython Wiki for swing examples. So I declare a JFrame, and then try to add a panel, some text fields, all that good stuff. I get this error when I run it, however. "'NoneType' object has no attribute 'add'" Here's the basic cod...

How to get the convert a Jython class to Java class in Jython intepreter?

I am trying to register a User Defined Function with Esper API. It take a class or string type arguement http://esper.codehaus.org/esper-4.0.0/doc/api/com/espertech/esper/client/ConfigurationOperations.html#addImport(java.lang.String) class MyUdf(): @staticmethod def udf(): return 50 conf.addImport(myudf.getClass().get...

sqlite3 module for Jython

I'm using Java Scripting API to execute some external Python scripts from my Java application. The python scripts use sqlite3 module. Execution of the application is resulting in error ImportError: No module named sqlite3 As I look into the Lib directory(which is in the classpath) of Jython, there's no sqlite3 module. Hence, my search...

Can't hit breakpoints for user generated actions when debugging jython code with PyDev in Eclipse

I'm implementing a GUI application in Jython, using Eclipse and PyDev plugin. The problem is that I have a hard time using the builtin debugger. When I start a debug session it just stops. Of course this should be expected as the program just creates a JFrame and then it's finished. So any breakpoints I put for different events .e.g. ...

Best dynamic language to pair with Java on a Java project

What is the best dynamic language to pair with Java on a large Java project? We are considering using a dynamic language for tests, controllers, services. Some options are Groovy, JRuby or Jython. What are the pros and cons of each for this? Ideally we'd be able to call Java from the dynamic language as well as call the dynamic langu...

Jython/Grinder/Grinderstone: self arg can't be coerced to net.grinder.plugin.http.HTTPUtilities

A grinder script i have been building out for the past few days has been working pretty well up until just now. I am getting a runtime error initially saying: self.token___LASTFOCUS = HTTPUtilities.valueFromHiddenInput('__LASTFOCUS') TypeError: valueFromHiddenInput(): expected 2-3 args; got 1 so i added [another arg][1], so...

Jython test coverage

I'm trying to use Jython instead of Python for a project (want jdbc driver for a sort of rare database). Everything is working OK so far, but I can't find any good tools for code coverage. Does anyone have a solution to this? The googling I've done seems to indicate that jython is missing some things that code coverage tools need. http:...

Jython, Django with Sqlite3

NOw i create project by using jython 2.5.2b2 and django1.1.1 (lucid) , after download sqlitejdbc-v056.jar and do some syncdb task its shown "zxJDBC.Error: auth_permission.content_type_id may not be NULL [SQLCode: 0]" but still can runserver, anyone has some great example for this situation?.:) ...

using python module in java with jython

hi guys, I have a couple of python modules in an existing Python project that I wish to make use of in my Java app. I found an article and followed the steps mentioned there. In particular, I need to import the java interface: package jyinterface.interfaces; public interface EmployeeType { . . } into the module: from jyin...

How to setup springpython with Jython and Eclipse/PyDev?

I'm having trouble setting up SpringPython with PyDev and Jython I've installed Spring python by: jython setup.py install and the setup installed the library to my jython installation successfully. See!: In my PyDev project i've selected the jython interpreter and have c:\jython2.5.1\Lib\site-packages in my Library paths: My ...

Jython: subprocess.Popen runs out of file descriptors

I'm using the Jython 2.51 implementation of Python to write a script that repeatedly invokes another process via subprocess.Popen and uses PIPE to pipe stdout and stderr to the parent process and stdin to the child process. After several hundred loop iterations, I seem to run out of file descriptors. The Python subprocess documentati...

convert Excel to csv either using shell script or jython . if so how

I am looking for a procedure where i can convert the excel to csv either if there some shell script , if so please guide me or if possbile how can i do in jython. The main reason is that the excel is being received from other source and the header is always changing , which is unnecessary and we need to have some automatic way to remov...

how do i use django with jython

hey dudes, currently i'm using django with python. I wanted to try using it with jython, so i installed the jython2.5.2b and edit the python.path to point to C:\Python26\Lib\site-packages I have also installed the django-jython extension in jython. However, I still encountered error ImportError: No module named django Does an...