jython

Can Jython replace Java?

So many server side and the mobile Java applications use the native Java language for Java. Can we use Jython instead to build the enterprise applications, e.g. websites, application servers etc. Also what do you feel about Java ME applications in Jython. P.S. Comments on question also welcome. ...

Convert JavaScript links to standard links

Hey, I am working with HTML which has javascript links like below: <a href="javascript:openExternalLink(5542, true, 'http://www.websitedomain.com')"&gt;Links Text Here</a> I need to replace these with standard anchor tags like so: <a href="http://www.websitedomain.com"&gt;Links Text Here</a> What would be the best solution to achi...

Preserving the Java-type of an object when passing it from Java to Jython

I wonder if it possible to not have jython automagicaly transform java objects to python types when you put them in a Java ArrayList. Example copied from a jython-console: >>> b = java.lang.Boolean("True"); >>> type(b) <type 'javainstance'> >>> isinstance(b, java.lang.Boolean); 1 So far, everything is fine but if I put the object in ...

How can I run the superscript plugin in Jedit?

The superscript plugin provides an environment to run a buffer text in different script engines. I have installed the plugin via the plugin manager -> superscript but now, when I enter in the buffer "2+2" and press "execute script" all I obtain is: bsh.util.BeanShellBSFEngine or org.apache.bsf.engines.activescript.ActiveScriptEngin...

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 such as Groovy, JRuby and Jython instead of straight Ruby or Python. Ruby and Python ca...

Java class from jython

Hi, I need to access the java class which is running jython script from that script? Any help? update: Something like this: //JAVA CLASS class Test{ public String text; public Test { PythonInterpreter pi = new PythonInterpreter(null); pi.execfile("test.py"); } } So int test.py I need to do some...

Jython: parsing text to float containing commas

How can I parse a float scanned from a sheet as text, containing commas? txt = "1,903.44" value = float(txt) # This fails due to ',' in string UPDATE: Sorry I wasn't clear. I'm using jython 2.5, which doesn't have the locale module. ...

Jython Development on Google App Engine

Does anyone have any direct experience (good or bad) using Jython with Google App Engine? ...

import from external lib jython

I am trying to imported a java class from an external lib in jyhon and it does not work. An example package run; import import.Imported; Class Run() { public static void main(String[] args){ pi = new PythonInterpreter(null); pi.execfile('script.py'); } } //this is an external...

Using java.util.prefs.Preferences in Jython

I seem to be having trouble storing Java preferences using a Jython script. If in Jython 2.5 beta I use: clazz = Class.forName('mypackage.myclass') prefs = Preferences.userNodeForPackage(clazz); # or Preferences.userRoot() prefs.put('propertyname', 'yes') The preferences are not stored. If I then add: prefs.flush() I get java.u...

Production ready Python implementations besides CPython?

Except for CPython, which other Python implementations are currently usable for production systems? The questions What are the pros and cons of the various Python implementations? I have been trying to wrap my head around the PyPy project. So, fast-foward 5-10 years in the future what will PyPy have to offer over CPython, Jython, and...

Dom4j detach node, Jython

Hey, I am using Dom4j to detach a node, like below: <div name="divName"> Some Text Here <span>Some Text Here</span> </div> I am selecting the div node by name and then using the detach method to remove it: xpathValue = "//*[contains(@name, 'divName')]" xpath = dom.createXPath(xpathValue) if xpath != None: nodes =...

How do I use a Python library in my Java application?

What are the basic nuts and bolts of calling (running? interpreting? what can you do?) Python code from a Java program? Are there many ways to do it? ...

What is the most state-of-the-art, pure python, XML parser available?

Considering that I want to write python code that would run on Google App Engine and also inside jython, C-extensions are not an option. Amara was a nice library, but due to its C-extensions, I can't use it for either of these platforms. ...

Writing XML from Python : Python equivalent of .NET XmlTextWriter?

I have some IronPython code which makes use of XmlTextWriter which allows me to write code like self.writer = System.Xml.XmlTextWriter(filename, None) self.writer.Formatting = Formatting.Indented self.writer.WriteStartElement(name) self.writer.WriteString(str(text)) self.writer.WriteEndElement() ... self.writer.Close() I would like ...

Dynamic languages - which one should I choose?

Dynamic languages are on the rise and there are plenty of them: e.g. Ruby, Groovy, Jython, Scala (static, but has the look and feel of a dynamic language) etc etc. My background is in Java SE and EE programming and I want to extend my knowledge into one of these dynamic languages to be better prepared for the future. But which dynamic l...

Replace text, Jython, Regex

Hey, I am processing my website and wanting to change some things on the pages. I am wanting to replace the following string: in the <SPAN class="Bold"> More... </SPAN> column to your right. Some times is does not have the <span> tags : in the More... column to your right. I would like to replace this with "below". I tried doing...

.class file from jython with pydev

My first attempt at jython is a java/jython project I'm writing in eclipse with pydev. I created a java project and then made it a pydev project by the RightClick project >> pydev >> set as... you get the idea. I then added two source folders, one for java and one for jython, and each source folder has a package. And I set each folder a...

How can I load jar files for debugging in Jython?

The title says it all ...

cross platform settings directory

Hi I am making a jython application that needs a config/settings file (and probably eventually directory) but I want it be stored in the expected/correct directory for each os. ~/.app_name/config in linux c:/documents and Settings/User/app_name ?? in windows. I have found this: http://snipplr.com/view/7354/home-directory-crossos/ b...