jython

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? ...

Is there an integrated Eclipse plugin to debug Jython?

JyDT is a good Jython Eclipse plugin. However, it doesn't allow Jython debugging in the Debug perspective. Jython provides a command-line debugger (Pdb) but it operates outside Eclipse. ...

Why use Jython when you could just use Java?

The standard answer is that it's useful when you only need to write a few lines of code ... I have both languages integrated inside of Eclipse. Because Eclipse handles the compiling, interpreting, running etc. both "run" exactly the same. The Eclipse IDE for both is similar - instant "compilation", intellisense etc. Both allow the use ...

IronClad equivalent for Jython

For IronPython there is a project - IronClad, that aims to transparently run C extensions in it. Is there a similiar project for Jython? ...

What is the simplest way to offer/consume web services in jython?

I have an application for Tomcat which needs to offer/consume web services. Since Java web services are a nightmare (xml, code generation, etc.) compared with what is possible in Python, I would like to learn from your experience using jython instead of java for offerring/consuming web services. What I have done so far involves adapting...

Java: Scripting language (macro) to embed into a Java desktop application

I am writing a graphics application in Java. Eventually I would like to build in a scripting language so things are programmable. Which language library do you recommend? Likely suspects are: Rhino (JavaScript) JRuby (Ruby) Jython (Python) Less likely candidates are: Whip up my own language using JavaCC LuaJava (Lua) Groovy JavaFX...

Automated Python to Java translation

Is there a tool out there that can automatically convert Python to Java? Can Jython do this? ...

Template Lib (Engine) in Python running with Jython

Im searching a Template Lib or Template Engine for generating HTML (XML) that runs under Jython (Jython 2.5 Alpha is ok). ...

How to add jars dynamically with jython embedded in Tomcat app?

I want to let the users of my app, which is in turn an app container (app contains subapps), add java jars to their jython path. I let the subapp managers write thir own extensions in jython, but some of the functionality they want to add needs additional jars. For example, if they want to check a svn repo, they need the svn access jars...

Controlling the execution of a Jython script from Java

I'm trying to control the execution of a Jython script from within Java and executed through a call to PythonInterpreter.exec(). The script contains calls to classes defined in Java. I'll call these classes "commands" for the discussion here. The commands can also be run on a different machine via RMI. Since the commands take a while t...

Jython Spliting String Up

Hi, I am trying to manipulate a string using Jython, I have included below an example string: This would be a title for a website :: SiteName This would be a title for a website :: SiteName :: SiteName I am trying to remove all instances of ":: Sitename" or ":: SiteName :: SiteName", can anyone help me out? Cheers ...

HashSet problem -- equals and hashCode with contains working differently than I'd expect

I have the following code: class IncidentTag: def __init__(self,tag): self.tag = tag def equals(self,obj): return self.tag.equals(obj.tag) def hashCode(self): return self.tag.hashCode() from java.lang import String from java.util import HashMap from java.util import HashSet tag1 = IncidentTag(Str...

Need help making Jython (dom4j) script more graceful :)

Hi All, I have started using Jython as it seems to be a excellent language, and has proved to be so far. I am using dom4j to manipulate and retrieve data from the DOM of a bunch of HTML files I have on disk. I have wrote the below script to check threw the DOM using Xpath for H1 tags and grab text, if a H1 tag is not present in the DO...

Is adding elements between elements with Jython and dom4j possible?

Hi, Just playing with dom4j, excellent. I was a PHP developer for a year and half, just got a new job and started playing around with Jython now I have spare time, its a great language. Was thinking about trying to add a element in between element, example below: <div id="content"> <p>Some text in here</p> <!--New p tag here--...

Jython - javaos.getenv() gives "Failed to get environment, environ will be empty"

I'm wondering if anyone ran into this problem. Whenever I run any jython program in Eclipse, I got the following error in the beginning of the output: " Failed to get environment, environ will be empty: (0, 'Failed to execute command ([\'sh\', \'-c\', \'env\']): java.io.IOException: Cannot run program "sh": Crea teProcess ...

Jython 2.2.1, howto move a file? shutils.move is non-existant!

'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move a file with Jython? and while we at it, how does one delete a file with Jython? ...

Sorting list of URLs by length in Jython

Hi, I am writing a Jython script to sort a list of URLs. I have a list that looks like this: http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/folder3/|,1 http://www.domain.com/folder1/|,1 http://www.domain.com/folder1/folder2/|,1 http://www.domain.com/folder1/folder2/|,1...

Jython and Java nested class

Hi, I'm using Jython to write tests for a Java project. It works well, but I can't figure how to get access to a java public nested class. package mypackage; public class NyClass { public class MyNestedClass { ... } } Does somebody knows how to do this? ...

what are the limitations of jython's PyObject.__tojava__ method?

Jython's PyObject provides a method to cast a python object to java. There are some old articles on Jython Monthly describing the use of __tojava__ to create a jython object factory Besides the need for an interface, are there any other limitations to using Jython to create "java" objects. ...

using jython and open office 2.4 to convert docs to pdf

Hi guys I completed a python script using pyuno which successfully converted a document/ xls / rtf etc to a pdf. Then I needed to update a mssql database, due to open office currently supporting python 2.3, it's ancientness, lacks support for decent database libs. So I have resorted to using Jython, this way im not burdened down by runn...