jython

Jython : Issues executing XSLT

家住魔仙堡 提交于 2019-12-11 15:03:40
问题 Ignoring identation, below Jython code when executed from command line produces, output with self-closing tags(No data), as shown in the picture below from java.io import * import javax.xml from java.io import StringReader, StringWriter from javax.xml.transform import Transformer, TransformerFactory from javax.xml.transform.stream import StreamResult, StreamSource def obtainservicexslts(): print "In obtainservicexslts" print source_xform_xml = """<?xml version='1.0' encoding='UTF-8'?>

Using Nailgun in Eclipse for Java and Jython

你离开我真会死。 提交于 2019-12-11 14:39:01
问题 I have just set up Nailgun (https://github.com/martylamb/nailgun, http://martiansoftware.com/nailgun/), which is a clever piece of kit which makes the JVM hang around in memory making Java and Jython (potentially) launch more quickly. This is great for Java, but it promises to be absolute gold dust for me for Jython, particularly during development (Jython is the best language in the world, but has a slow start-up time). Googling to see whether anyone had tackled running Nailgun on Eclipse I

HTTPS get using Jython

对着背影说爱祢 提交于 2019-12-11 12:48:54
问题 Please see my code below. Basically it's a script that queries an API service with a hostname as the parameter, which then returns some meta data associated with this server. Now, it works really well when executed from a Python 2.7 compiler that's been installed into a windows machine, also works using CURL from a bash CLI (meaning that the URL is definitely working), but this script will be running on an HP application that has an embedded JVM wrapper, meaning that it will use Jython and

Jython (JES) - 90 degree rotation function

感情迁移 提交于 2019-12-11 11:52:05
问题 I need to write a function spin(pic,x) where it will take a picture and rotate it 90 degrees counter clockwise X amount of times. I have just the 90 degree clockwise rotation in a function: def rotate(pic): width = getWidth(pic) height = getHeight(pic) new = makeEmptyPicture(height,width) tarX = 0 for x in range(0,width): tarY = 0 for y in range(0,height): p = getPixel(pic,x,y) color = getColor(p) setColor(getPixel(new,tarY,width-tarX-1),color) tarY = tarY + 1 tarX = tarX +1 show(new) return

Where is the location of the fcntl module of python?

馋奶兔 提交于 2019-12-11 10:57:54
问题 I'm on unix but I can't find the location of the fcntl module. I'm using Jython in my web development, and the existing program that I'm modifying needs that module. Can you give me a way to import it or for my code to be able to use this module? Thanks in advance! 回答1: fcntl is a built-in module. It's not written in Python, but in C. Unfortunately, it hasn't been ported to Java, and according to this bug report, it's unlikely that it ever will be. To answer your question: it's in the CPython

wsadmin + jython delete folder

╄→尐↘猪︶ㄣ 提交于 2019-12-11 10:30:14
问题 I want to do post-deploy script using standalone wsadmin. It should delete all caches on profile (/profile/temp /profile/myCacheFolder). My question is, is it possible to do this with wsadmin? If so how? Can I somehow use AdminConfig.deleteDocument or something like this? thank you 回答1: With AntAgent MBean you can upload ant script and then invoke it on remote node: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.javadoc.doc/web/mbeanDocs/AntAgent.html from java.lang

Convert Jython scripts to .jar file

我的梦境 提交于 2019-12-11 09:48:44
问题 I have been trying to convert jython scripts to .jar file. I followed, Distributing my Python scripts as JAR files with Jython? The link above and also the Jython wiki link shown inside it use a command line script called, "zip". Its like => zip myapp.jar Lib and so. I am on windows machine, so I couldn't find any script as "zip" on my command line, may be its a Linux script. Help me to do it in windows machine Second is I have few external .jar's that are used in my jython scripts, for this

Wrong number or types of arguments in call to procedure with use zxJDBC

我的未来我决定 提交于 2019-12-11 09:34:33
问题 I took official example from http://www.jython.org/archive/21/docs/zxjdbc.html: Oracle >>> c = db.cursor() # open the database as in the examples above >>> c.execute("create or replace function funcout (y out varchar2) return varchar2 is begin y := 'tested'; return 'returned'; end;") >>> params = [None] >>> c.callproc("funcout", params) >>> print params When I run this code I get exception: PLS-00306: wrong number or types of arguments in call to 'FUNCOUT' ORA-06550: line 1, column 7: PL/SQL:

Passing arguments to Python script in Java

给你一囗甜甜゛ 提交于 2019-12-11 08:48:02
问题 I'm running a python script in a java class like this: PythonInterpreter interp = new PythonInterpreter(); PythonInterpreter.initialize(System.getProperties(), System.getProperties(), new String[0]); interp.execfile("C:\\Users\\user1\\workspace\\Projectx\\script.py"); The problem is that script.py usually takes commandline arguments like this: python script.py -i C:/diretory/path -o C:/directory/path Is it possible to pass those arguments via the PythonIntepereter in Java ? Update: Thx to

Lookup in Jython (and Gephi)

感情迁移 提交于 2019-12-11 08:29:58
问题 I'm trying to use Gephi Toolkit in Jython, but having problems with it. The code is below: import sys sys.path.append('gephi-toolkit.jar') from org.openide.util import Lookup import org.gephi.project.api.ProjectController as ProjectController pc = Lookup.getDefault().lookup(ProjectController) workspace = pc.newProject() print "done." It never reaches the last line. Instead gives the following error: Traceback (most recent call last): File "standalone.py", line 9, in <module> workspace = pc