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
11
votes
3 answers

Security with Java Scripting (JRuby, Jython, Groovy, BeanShell, etc)

I'm looking to run some un-verified scripts (written in a yet-to-be-determined language, but needs to be Java-based, so JRuby, Groovy, Jython, BeanShell, etc are all candidates). I want these scripts to be able to do some things and restricted from…
Patrick Lightbody
  • 4,424
  • 2
  • 28
  • 38
11
votes
3 answers

Is it possible to use SWT from Jython?

The SWT-Gui looks very nice. Is there an easy way to use it in Jython ?
Natascha
  • 133
  • 1
  • 7
11
votes
1 answer

Jython + Django not ready for production?

So recently I was playing around with Django on the Jython platform and wanted to see its performance in "production". The site I tested with was just a simple return HttpResponse("Time %.2f" % time.time()) view, so no database involved. I tried the…
AndiDog
  • 68,631
  • 21
  • 159
  • 205
11
votes
4 answers

Some basic clarifications about Python?

Last night I came across the term called Jython which was kind of new to me so I started reading about it only to add more to my confusion about Python in general. I have never really used Python either. So here is what I am confused about. Python…
EsotericMe
  • 811
  • 1
  • 5
  • 11
11
votes
1 answer

Why does "as" cause a SyntaxError in an "except" statement in Jython 2.5?

I got the following syntax error at the following line when I run my program in jython: except Exception as detail: SyntaxError: mismatched input 'as' expecting COLON but on python is it ok? What is wrong? I am trying to use the stanford pos tagger…
goh
  • 27,631
  • 28
  • 89
  • 151
11
votes
2 answers

Using JRuby/Jython for Ruby/Python interoperability?

Quite-probably a silly question, as I don't know much about Java/Jython/JRuby/bytecode, but.. I stumbled across _why's unholy again today.. It allows you to output Python bytecode from Ruby code.. Basically allowing them to produce the same…
dbr
  • 165,801
  • 69
  • 278
  • 343
10
votes
4 answers

How to call a python method from a java class?

I am using Jython within a Java project. I have one Java class: myJavaClass.java and one Python class: myPythonClass.py public class myJavaClass{ public String myMethod() { PythonInterpreter interpreter = new PythonInterpreter(); …
Hasti
  • 239
  • 1
  • 3
  • 17
10
votes
6 answers

Python thinks I'm passing more arguments than I am?

Trying to set up some basic socket code in Python (well, Jython, but I don't think that's relevant here). import socket class Foo(object): def __init__(self): #some other init code here s = socket.socket(socket.AF_INET,…
Cam Jackson
  • 11,860
  • 8
  • 45
  • 78
10
votes
3 answers

How do I use unittest.TestResult?

I've only been using unittest for a short time. I am using Jython 2.7.10 "final release" In the Python 2.7 docs explaining TestResult it says: The following methods of the TestResult class are used to maintain the internal data structures, and…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
10
votes
0 answers

Limiting memory usage of a Java/Rhino/Nashorn object

I'm extending a server application written in Java to allow user-defined callbacks (written in Javascript) to be run in response to requests. I've done some reading, and while it seems possible to disable Java classes in Nashorn, there is nothing…
WhatAWorld
  • 394
  • 4
  • 12
10
votes
2 answers

Calling Python from Java through scripting engine (jython)?

I'm trying to call Jython from a Java 6 application using javax.script: import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class jythonEx { public static void main (String…
griffin
  • 3,158
  • 8
  • 37
  • 34
10
votes
3 answers

running jython bytecode using java

It looks like I'm missing something. When using Jython to run my Python code in Java, Java bytecode files are generated (test.py -> test@py.class). Can I run these classes directly using java? In other words, I want to make this: $ java test@py…
noamtm
  • 12,435
  • 15
  • 71
  • 107
10
votes
2 answers

SyntaxError "no viable alternative at input 'self'"

I have a gui.py file containing the following code: from javax.swing import JFrame, JPanel, Box, JComboBox, JSpinner, JButton, JLabel, SpinnerNumberModel, WindowConstants from java.awt import BoxLayout, GridLayout class SettingsWindow: def…
Timothy
  • 155
  • 1
  • 1
  • 7
10
votes
2 answers

SAX IncrementalParser in Jython

Python standard library provides xml.sax.xmlreader.IncrementalParser interface which has feed() method. Jython also provides xml.sax package that uses Java SAX parser implementation under the hood, but it seems not to provide IncrementalParser. Is…
minhee
  • 5,688
  • 5
  • 43
  • 81
10
votes
2 answers

Human-friendly WebSphere scripting tool/library?

I'm developing lots of scripts for managing WAS infrastructure and I'm getting an impression that somebody at IBM has screwed up wsadmin on purpose. It couldn't be an accident. Here's a "simple" example: for node in…
Marcin Płonka
  • 2,840
  • 1
  • 17
  • 17