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
21
votes
4 answers

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…
Hanno Fietz
  • 30,799
  • 47
  • 148
  • 234
20
votes
4 answers

Jython and python modules

I've just started using the PythonInterpreter from within my Java classes, and it works great! However, if I try to include python modules (re, HTMLParser, etc.), I'm receiving the following exception (for re): Exception in thread "main" Traceback…
Geo
  • 93,257
  • 117
  • 344
  • 520
20
votes
2 answers

Pure python implementation of greenlet API

The greenlet package is used by gevent and eventlet for asynchronous IO. It is written as a C-extension and therefore doesn't work with Jython or IronPython. If performance is of no concern, what is the easiest approach to implementing the…
Tristan
  • 6,776
  • 5
  • 40
  • 63
17
votes
5 answers

Using NumPy and Cpython with Jython

I must use a commercial Java library, and would like to do it from Python. Jython is robust and I am fine with it being a few dot releases behind. However, I would like to use NumPy as well, which obviously does not work with Jython. Options like…
gappy
  • 10,095
  • 14
  • 54
  • 73
17
votes
3 answers

How to read the last MB of a very large text file

I am trying to find a string near the end of a text file. The problem is that the text file can vary greatly in size. From 3MB to 4GB. But everytime I try to run a script to find this string in a text file that is around 3GB, my computer runs out of…
nkshakya1
  • 173
  • 1
  • 4
17
votes
4 answers

jython multithreading

I started studying python a couple of month ago, then I found Jython. Do threads work properly in Jython, since it doesn't have a GIL? If so, can you suggest a good book on concurrency (threading)?
nassio
  • 635
  • 1
  • 10
  • 19
16
votes
6 answers

What are some strategies to write python code that works in CPython, Jython and IronPython

Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environment. Have you got a great way to handle this situation?
minty
  • 22,235
  • 40
  • 89
  • 106
16
votes
2 answers

Jython CLASSPATH, sys.path and JDBC drivers

How can I add JDBC drivers at runtime to Jython? Using CLASSPATH works, but using sys.path doesn't work with zxJDBC even though the class is imported fine and can be manipulated from the Jython interpreter prompt. Why does this work: $…
lmz
  • 1,560
  • 1
  • 9
  • 19
16
votes
5 answers

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…
Vasil
  • 36,468
  • 26
  • 90
  • 114
15
votes
1 answer

Interoperability of Scala and Jython

I would think that since they both run on the JVM, Scala and Jython could be used together. How well do they interface? Can you make calls to Scala libraries from Jython? What about Jython libraries from Scala?
Keith Pinson
  • 7,835
  • 7
  • 61
  • 104
15
votes
4 answers

Using Jython with Maven

I have a Maven module, that depends on various other Maven dependencies by which I am accessing through my jython code. I am now done, and I would like to compile the project as a .jar, or even just run it without compiling, but I have no clue where…
nubela
  • 1
  • 24
  • 75
  • 123
15
votes
3 answers

Importing python modules in jython

I'm having some issues importing scapy under jython. I've been doing java forever, but python for only a day or two. The simple case to reproduce the problem is: $jython >>> import sys >>> sys.path ['', '/usr/share/jython/Lib',…
TheBigS
  • 491
  • 1
  • 4
  • 14
15
votes
2 answers

Why does this Jython loop fail after a single run?

I've got the following code: public static String getVersion() { PythonInterpreter interpreter = new PythonInterpreter(); try { interpreter.exec(IOUtils.toString(new FileReader("./Application Documents/Scripts/Version.py"))); …
Zizouz212
  • 4,908
  • 5
  • 42
  • 66
15
votes
2 answers

Redux: How do I get Jython to use Python modules stored in Lib within its own jar file when running in Hadoop?

I'm attempting to use Jython for an implementation within Hadoop 1.2.1. I have seen strikingly little about Jython+Hadoop other than stale projects (like code.google.com/p/happy), and a stale implementation in…
hoc_age
  • 1,945
  • 2
  • 18
  • 28
15
votes
4 answers

Differences between Jython and Python

I know Jython converts Python code into Java byte code, but are there any syntax changes between the two? and as a side question is Jython 3.x usable yet or is it still being ported?
RandomPhobia
  • 4,698
  • 7
  • 25
  • 22