jython

Does sphinx run on Jython?

I'm still looking for a usable documentation tool chain. Working in the Java environment but also a Python user, I wondered if Sphinx would run on Jython 2.5? ...

Extract only numbers from data in Jython

Hello, Here is my problem. I'm working on a Jython program and I have to extract numbers from a PyJavaInstance: [{string1="foo", xxx1, xxx2, ..., xxxN, string2="bar"}] (where xxx are the floating point numbers). My question is how can I extract the numbers and put them in a more simple structure like a python list. Thank you in adv...

Can I detect if my code is running on cPython or Jython?

I'm working on a small django project that will be deployed in a servlet container later. But development is much faster if I work with cPython instead of Jython. So what I want to do is test if my code is running on cPython or Jython in my settiings.py so I can tell it to use the appropriate db driver (postgresql_psycopg2 or doj.backend...

Issues with inspect.py when used inside Jython

Hi, I am using an application developed in Jython. When I try to use the inspect.py in that, it shows error message. My code goes like this import inspect,os,sys,pprint,imp def handle_stackframe_without_leak(getframe): frame = inspect.currentframe() try: function = inspect.getframeinfo(getframe) print inspect.g...

Jython: Instantiating java class in script as Java object, not as Python object.

Hi guys. I have a problem when using Jython, but I can't seem to find a solution in the documentation. Basically what I have is an object that has been instantiated in Java, and I want to instantiate another Java object (in the python script) and have the pre-instatiated java object added to the object I have instantiated in the jython...

How to deactivate JLine for Jython interactive interpreter session?

Jython 2.5 comes with JLine per default. I would prefer to use the interactive interpreter with rlwrap. It seems that rlwrap is not working if JLine is active. In Scala I would use rlwrap scala -Xnojline. Is there a similar option for Jython to deactivate JLine? ...

Does Jython have the GIL?

I was sure that it hasn't, but looking for a definite answer on the Interwebs left me in doubt. For example, I got a 2008 post which sort of looked like a joke at first glance but seemed to be serious at looking closer. Edit: ... and turned out to be a joke after looking even closer. Sorry for the confusion. Actually the comments on tha...

Jython or JRuby?

It's a high level conceptual question. I have two separate code bases that serve the same purpose, one built in Python and the other in Ruby. I need to develop something that will run on JVM. So I have two choices: convert the Python code to Jython or convert the Ruby to JRuby. Since I don't know any of them, I was wondering if anyone ca...

Retrieving Raw_Input from a system ran script

I'm using the OS.System command to call a python script. example: OS.System("call jython script.py") In the script I'm calling, the following command is present: x = raw_input("Waiting for input") If I run script.py from the command line I can input data no problem, if I run it via the automated approach I get an EOFError. I've r...

fast-ish python/jython IPC?

All I want to do is make some RPC calls over sockets. I have a server that does backendish stuff running jython 2.5. I need to make some calls from a frontend server running Django on CPython. I've been beating my head against a wall getting any form of IPC going. The list of things I've tried: Apache Thrift doesn't have any actual re...

Using Python from within Java

Possible Duplicate: Java Python Integration I have a large existing codebase written in 100% Java, but I would like to use Python for some new sections of it. I need to do some text and language processing, and I'd much rather use Python and a library like NLTK to do this. I'm aware of the Jython project, but it looks like thi...

Intercept slice operations in Python

I want to imitate a normal python list, except whenever elements are added or removed via slicing, I want to 'save' the list. Is this possible? This was my attempt but it will never print 'saving'. class InterceptedList(list): def addSave(func): def newfunc(self, *args): func(self, *args) print 'savi...

Randomness in Jython

When using (pseudo) random numbers in Jython, would it be more efficient to use the Python random module or Java's random class? ...

Handling Swing focus events with Jython

Jython 2.5 I'm trying to bind a method to the focusGained event of a JText control, but all the examples that I found are Java samples, not Jython. Here's the code, I want to run a custom method when each text control gains focus (to select all the control's text, for instance) from javax.swing import * from java.awt import * class Te...

Remap keyboard navigation with Jython / Swing

Hi, I'm trying to remap several navigation keys: ENTER: to work like standard TAB behavior (focus to next control) SHIFT+ENTER: to work like SHIFT+TAB behavior (focus to previous control) UP / DOWN arrows: previous /next control etc I tried with a couple of options but without luck: from javax.swing import * from java.awt import * ...

Distributing my python scripts as jars with jython?

Hi all, I have been a python programmer for almost 2 years and I am used to writing small scripts to automate some repetitive tasks I had to do at office. Now, apparently my colleagues noticed this and they want those scripts too. Some of them have macs, some windows, I made these on windows. I investigated the possibility of using py2e...

Howto multithreaded jython scripts running from java?

I'm constructing a framework in Java that will listen for events and then process them in Jython. Different event types will be sent to different scripts. Since jython takes quite some time to compile the script when PythonInterpreter.exec() is called, I will have to pre-compile the scripts. I'm doing it the following way: // initiali...

Jython (pass float array to java) is there more pythonic way?

I am writing jython application with eclipse SWT/JFace. I have to pass float array to java object to get back some values from it. I am using jarray package for it. Is there more pythonic way to do it? bounds = zeros(4, 'f') # from java org.eclipse.swt.graphics.Path.getBounds(float[] bounds) path.getBounds(bounds) # from java org.eclips...

Infix operators in Scala and Jython

I'm evaluating languages for a computational oriented app that needs an easy embedded scripting language for end users. I have been thinking of using Scala as the main underlying language and Jython for the scripting interface. An appeal of Scala is that I can define methods such as :* for elementwise multiplication of a matrix object a...

log4j with third-party-initialized JVM, multiple JAR files and Jython

I have a mess I would like to attach log4j logging to. Let me try to explain the process. Third-party application launches a JVM and loads Main.jar. Main.jar includes a properties file for log4j logging and code to read it in with a PropertyConfigurator. Logging in Main.jar works. Later, third-party application loads JythonApp.jar. Jyt...