jython

Maximo scripting cannot load second MboSet

只愿长相守 提交于 2019-12-08 11:46:27
问题 I've a script with an object launchpoint on INVOICELINE. For the mbo I want to get all INVOICELINES with the same PONUM as the current MBO (since they could be in other then the current mbo's invoice) In the script I find the PO like so: (to test for status) from psdi.server import MXServer from psdi.mbo import Mbo from psdi.mbo import MboConstants from psdi.security import UserInfo from psdi.server import MXServer myMXServer = MXServer.getMXServer() userInfo = mbo.getThisMboSet().getUserInfo

Jython: Parse JSON object to get value (object has array)

久未见 提交于 2019-12-08 11:19:14
问题 I have JavaScript that parses a JSON object (object has array) and returns the value from the ZONE field. var obj = JSON.parse(json_text); parsed_val = obj.features[0].attributes.ZONE I would like to convert the JavaScript code to Jython . This is what I've tried: from com.ibm.json.java import JSONObject obj = JSONObject.parse(json_text) parsed_val = obj.get('features.attributes.ZONE'); The Jython compiles, but it doesn't return a valid value (it returns None ). I think this is because I

Redirection opeartors, < and >, in os.system(cmd)

寵の児 提交于 2019-12-08 10:12:21
问题 It is recommended that os.system is used for executing commands from python scripts. Furthermore, it is claimed that redirection operator work in there. For instance here and here. I do os.system("ls > out.txt") This works indeed on one of my computers. Another produces ls: cannot access >: No such file or directory ls: cannot access out.txt: No such file or directory I am a bit limited on the other with access right to investigate which process produces this message. But os.system("ls")

Can't run Grinder Java Test Framework

旧巷老猫 提交于 2019-12-08 08:38:57
问题 I can't run Grinder3 framework with Jython. I've downloaded it and I see that there are a lib/ folder with some .jar files. The grinder3 provide some examples (written in python). I receiver an error when I try to run these example with jython, the error tells me that the lib cannot be found. How should I include those jar to be able to run the examples? Traceback (most recent call last): File "amazon.py", line 18, in <module> from net.grinder.script.Grinder import grinder ImportError: No

how to add module of python into java using jython jar

放肆的年华 提交于 2019-12-08 08:15:02
问题 I used Netbeans platform to build my application uasing java languge.I need to invoke some python functions into java class using jython was the only way. unfortunatly when I tried to run the program an error showed indicate that the application did not find the following modules Exception in thread "main" Traceback (most recent call last): File "script.py", line 13, in <module> import re ImportError: No module named re File "script.py", line 14, in <module> from string import * ImportError:

How can I exec an interactive shell from Jython?

馋奶兔 提交于 2019-12-08 07:54:39
问题 I need some example Jython, or Java, code to exec an interactive OS shell (/bin/sh). Our development environment is Java on Linux. What I would like to do is provide a means for developers to write Jython scripts, and then drop into a shell, which allows them to inspect the system. The reason I need to exec this from Jython or Java--as opposed to just wrapping all this in a shell script--is that we use Java load some libraries which I need to keep loaded while the interactive shell is running

Jython subprocess.call() to Python

点点圈 提交于 2019-12-08 05:43:53
问题 I'm attempting to make use of a CPython library from a Jython program through a subprocess.call() to a python script. I can make the call through the Jython interpreter without any problem. [OpenJDK Server VM (Sun Microsystems Inc.)] on java1.6.0_22 Type "help", "copyright", "credits" or "license" for more information. >>> import subprocess >>> subprocess.call('python /opt/fake.py', shell=True) ok! 0 But when I call the script from within my Jython program being built in Eclipse/PyDev:

Python Interpreter Jython - execution of modules

我的梦境 提交于 2019-12-08 05:26:47
问题 Here's the link to the problem: Python Interpreter in Jython The following was a potential solution: interp.exec("import os.path.abspath(__file__)/printTwice.py)"); interp.exec("printTwice.print_twice('Adam')"); However it returned an error: This returned the following error: Exception in thread "main" SyntaxError: ("mismatched input '(' expecting NEWLINE", ('', 1, 22, 'import os.path.abspath(file)/printTwice.py)\n')) 回答1: interp.exec("import printTwice"); interp.exec("printTwice.print_twice(

Bundling python(“.py”)files along with java class files for a web application

筅森魡賤 提交于 2019-12-08 05:10:01
问题 We are having an java we application where flex is front end and we use Axis2 for web services.So what ever the java code for services we bundle java classes as an aar file ans supply to axis2 with which flex interacts. Recently we had a req where we need to use some python code from java, So Eclipse, i setup by adding jython.jar,plyJy.jar to the lib folder and added what ever the py files needed to the src folder and i was able to use python methods in the java code. PySystemObjectFactory

Why am I getting an error when I run the migrate command on Jython-Django 1.7? How do I resolve it?

蓝咒 提交于 2019-12-08 03:28:22
问题 I hoping that you can help me out. I currently have Django1.7 running on windows7/Java7/Jython2.7/Postgresql9.3/postgresql-9.3-1102.jdbc41. I learned today that on Django 1.7 there is no reason to install the South package for migrations because 1.7 has makemigrations and migrate commands built in. But even so when I try to apply those commands in that order I am getting some sort of error. How can I resolve this error? For more information on django migrations. Django 1.7 Migrations For more