Questions tagged [jython]

Jython is an open-source implementation of the Python programming language in Java. Use this tag for questions specific to this implementation, general Python questions should just be tagged with "python".

Jython is an open-source implementation of the Python programming language written in Java. It is seamlessly integrated with Java, in that it can import and use any Java class. Jython is extensively used as a official scripting language for all WebLogic Server administration tasks.

Jython is also used for administrative scripting for IBM's WebSphere Application Server through the Wsadmin client.

Helpful References

2784 questions
8
votes
1 answer

Event handling with Jython & Swing

I'm making a GUI by using Swing from Jython. Event handling seems to be particularly elegant from Jython, just set JButton("Push me", actionPerformed = nameOfFunctionToCall) However, trying same thing inside a class gets difficult. Naively…
Joonas Pulakka
  • 36,252
  • 29
  • 106
  • 169
8
votes
5 answers

How do I trim the decimal of a number using clojure or jython?

In clojure or jython: say I have a number 4.21312312312312 how can i get a number with just the first 2 decimals. It would return 4.21 for the example above. Thanks
Julio Diaz
  • 9,067
  • 19
  • 55
  • 70
8
votes
1 answer

.sendto() method on sikuli python script does not work on windows

I developed a sikuli python script on windows that uses this code: from socket import AF_INET, SOCK_DGRAM import sys import socket import struct, time host = "pool.ntp.org" port = 123 buf = 1024 address = (host,port) msg = '\x1b' + 47 * '\0' #…
user3472065
  • 1,259
  • 4
  • 16
  • 32
8
votes
0 answers

How can I run python script in android studio with java

I have a script in python. Here is some of my code: from splinter import Browser url = "http://arashiyan.ir/Narm/entekhab.html" browser=Browser('firefox') browser.visit(url) second_found =…
Ashkan Rahmani
  • 758
  • 1
  • 8
  • 20
8
votes
3 answers

PyDev: Jython modules & Java classes in the same project

I come from a Java world and am totally new to Jython. Is it possible to create a project in Eclipse with both Jython and Java classes on the same project? I tried to do so -writing a simple Java class and using it in Jython module- and everything…
BahmanM
  • 1,420
  • 10
  • 18
8
votes
0 answers

How can I force a Python ScriptEngine to flush its cache of imported modules?

I am using a Python ScriptEngine in my Java application to execute a Python script that imports various other Python scripts. Once the main script successfully completes and the eval method returns, I set the engine object reference to null and call…
Blaine
  • 81
  • 2
8
votes
6 answers

Decoding json in jython using only default libraries

I have a question about getting json into my jython script. Here's my scenario: I am running a python app on my laptop That app needs to share data with a jython app running in a hosted environment out in a 3rd party's cloud environment. I have…
eric woodworth
  • 163
  • 2
  • 10
8
votes
3 answers

Jython 2.5.1: "ImportError: No Module named os"

I looked through the other posts and bug reports and couldn't figure out what's causing this. I'm using Jython 2.5.1, in a Java project in Eclipse (Ubuntu 8.10). It has been added to the project as a standalone .jar file (I just replaced the old…
Leonidas
  • 2,110
  • 4
  • 20
  • 31
8
votes
2 answers

Advantages of using jython vs. jacl in wsadmin scripting (WebSphere Application Server 7+)

Facing the programming for the wsadmin scripting client I see that you can use both jacl and jython. I've the same level of confidence with both two languages. I'm wondering if, in the specific of wsadmin programming , there are advantages of using…
Franco Rondini
  • 10,841
  • 8
  • 51
  • 77
8
votes
2 answers

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?
kzh
  • 19,810
  • 13
  • 73
  • 97
7
votes
3 answers

How do I make Hadoop find imported Python modules when using Python UDFs in Pig?

I am using Pig (0.9.1) with UDFs written in Python. The Python scripts import modules from the standard Python library. I have been able to run the Pig scrips that call the Python UDFs successfully in local mode, but when I run on the cluster it…
Ben Lever
  • 2,023
  • 7
  • 26
  • 34
7
votes
10 answers

Why do so many insist on dragging the JVM into new applications?

For example, I'm running into developers and architects who are scared to death of Rails apps, but love the idea of writing new Grails apps. From what I've seen, there is a LOT of resource overhead that goes into using the JVM to support languages…
Eric the Red
  • 5,364
  • 11
  • 49
  • 63
7
votes
1 answer

Downloading SetupTools in Maximo/Jython fails with HTTP error 403 SSL is required

Appendix A of The Definitive Guide to Jython describes downloading SetupTools for use with Jython. https://jython.readthedocs.io/en/latest/appendixA/ This indicates to me that it should be possible to download and use SetupTools from within a Jython…
Maximo.Wiki
  • 631
  • 5
  • 17
7
votes
2 answers

Benchmarking Java, Groovy, Jython and Python

I'm trying to benchmark a Monte Carlo calculation of PI (3.14159) throwing darts. I've implemented my code in Java, Groovy, BeanShell, Julia, Jython and Python (Python2 implemented in C). Here is my original Java code "MonteCarloPI.java": import…
user7975996
  • 109
  • 1
  • 6
7
votes
2 answers

Controlling stdout/stderr from Jython

I am calling a function in a java library from jython which prints to stdout. I would like to suppress this output from the jython script. I attempt the python idiom replacing sys.stdout with a file like object (StringIO), but this does not…
Mark Roddy
  • 27,122
  • 19
  • 67
  • 71