jython

jython 2.5 can't print string

﹥>﹥吖頭↗ 提交于 2019-12-24 12:44:17
问题 Jython 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06) [Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20 Type "help", "copyright", "credits" or "license" for more information. >>> print 3 3 >>> print "3" ... I tried version Jython 2.2.1, it was ok, but the problem remains in version Jython 2.7b1: Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52) [Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_39 Type "help", "copyright", "credits" or "license" for

Anyone tried Cluster automation with WLST?

青春壹個敷衍的年華 提交于 2019-12-24 07:19:16
问题 Most of the production env might need a automation script for Clusters. Reason is whenever there is a need of enhance the sites need to add new cluster to existing domain. When there is a decommissioned a physical site that needs removal of cluster from the domain. There is also possibility of "Growth" of Cluster (adding managed servers to a cluster). Finally there is also need of decommission of machines which requires removal of servers from the cluster. Menu 1. Add a Cluster 2. Del a

email.retr retrieves strange =20 characters when the email body has chinese characters in it

。_饼干妹妹 提交于 2019-12-24 04:59:28
问题 self.logger.info(msg) popinstance=poplib.POP3(self.account[0]) self.logger.info(popinstance.getwelcome()) popinstance.user(self.account[1]) popinstance.pass_(self.account[2]) try: (numMsgs, totalSize)=popinstance.stat() self.logger.info("POP contains " + str(numMsgs) + " emails") for thisNum in xrange(1, numMsgs + 1): try: (server_msg, body, octets)=popinstance.retr(thisNum) except: self.logger.error("Could not download email") raise text="\n".join(body) mesg=StringIO.StringIO(text) msg

Why does nailgun cache command line arguments?

▼魔方 西西 提交于 2019-12-24 02:18:13
问题 When running Jython programs through nailgun the jython program always runs with the command line arguments of the first time it was run. first I start nailgun: arthur@a:~/nailgun$ java -jar nailgun.jar NGServer started on all interfaces, port 2113. then when I run a simple jython script: import sys print sys.argv then add jython to nailguns classpath ./ng ng-cp /usr/share/java/jython.jar then run the script with the word "first" as an arguemnt: arthur@a:~/nailgun$ ./ng org.python.util.jython

Using/Creating Python objects with Jython

半腔热情 提交于 2019-12-24 01:38:42
问题 HI, lets say I have a Java interface B, something like this. B.java : public interface B { String FooBar(String s); } and I want to use it with a Python class D witch inherits B, like this. D.py : class D(B): def FooBar(s) return s + 'e' So now how do I get an instance of D in java? I'm sorry im asking such a n00b question but the Jython doc sucks / is partially off line. 回答1: Code for your example above. You also need to change the FooBar implementation to take a self argument since it is

How to check variable type using “type” function in Sikuli

风格不统一 提交于 2019-12-24 00:58:27
问题 Sikuli has its own function type for typing. Is there any way to invoke python (jython) function type ? Module builtins can’t be imported. Of course I can use isinstance instead but I am just curious if it is possible to come outside Sikuli scope and invoke not “overridden”, python built-in type function. I use Sikuli r930. #import builtins #ImportError: No module named builtins findAll("1369036502514.png") matches = getLastMatches() print(isinstance(matches,Finder)) #returns TRUE type(

Jython :: which modules are available to PythonInterpreter and how to add more

本小妞迷上赌 提交于 2019-12-23 22:03:01
问题 I am using the Jython 2.5.3 PythonInterpreter class to evaluate some simple scripts but when I need to import any non-core modules I get an exception. Do I have to add some jython library jars in the CLASSPATH? Narrow-down code that demonstrates the problem: import org.python.core.*; import org.python.util.PythonInterpreter; public class JythonTest { public static void main(String args[]) throws Exception { String scriptA = "import json"; // "import datetime" fails as well PythonInterpreter

Where in the world is com.ibm.ws.scripting.adminCommand.AdminTask?

元气小坏坏 提交于 2019-12-23 15:33:48
问题 Frustrated with the damn awful API provided by WebSphere Admin Server, I'm writing my own Java DSL wrapper. My jython files now simply read: from my.package import MyDSL config = MyDSL(AdminConfig, AdminTask) config.goGoGadgetSkates() # or something like that The essential part is that I send through the (#%$$!@#) god objects AdminConfig and AdminTask so that the DSL can use them to perform operations in WAS. In order to compile the DSL I need to include the class files for this two objects.

How to execute Python script from Java code in Android

℡╲_俬逩灬. 提交于 2019-12-23 10:53:27
问题 I'm trying to make an standard Android application execute a python script that could return values to Java, but I'm facing a lot of issues. Jython doesnt support this in the Android environment, SL4A is a dead project, Kivi seems to be an full stack framework that do not use Java at all and QPython is SL4A that works on Android 5+ but almost don't have documentation. I wanted something like: // From INSIDE my Java Code new PythonEngine().execute('a = 1 + 1').getInt('a') With QPython I found

Using Jython with M2Eclipse

泪湿孤枕 提交于 2019-12-23 09:38:16
问题 I currntly use M2Eclipse for the majority of my Java development and Pydev for Python/Jython development within Eclipse. I would like to use Jython to prototype and test classes within my Java projects. The M2Eclipse plugin manages all the dependencies defined in the Maven pom.xml file automatically. Is there anyway for Pydev to utilise these dependencies without having to import each jar separately? 回答1: Actually, I didn't get how you are working with Jython under Eclipse and where you need