jython

Bundling python files inside jar for access via jython

寵の児 提交于 2019-12-08 01:50:40
问题 In the following code I simply execute test.py from java code using jython public static void main(String[] args) { org.python.util.PythonInterpreter python = new org.python.util.PythonInterpreter(); python.execfile("test.py"); ... My problem is test.py needs to be in same directory from where jar file is run. I need this test.py bundled inside the jar and still be able to execute it using jython. Approach suggested in How do you invoke a python script inside a jar file using python? to read

Best tool to record CPU and memory usage with Grinder?

笑着哭i 提交于 2019-12-07 23:12:05
问题 I am using grinder in order to generate reports for the performance tests for my application. But I noticed that it does not generate any report on CPU and memory usage. On further investigation, I found that Grinder does not provide this information. Now, my question is, is there any tool that can be hooked up with grinder, to record the CPU and memory usage details? 回答1: As you have discovered, this is not supported directly in The Grinder itself. You will need to use a collection of tools

Invoking Jython without Weblogic's WLST

你离开我真会死。 提交于 2019-12-07 21:50:24
问题 I'm using an AIX machine which has Weblogic 9.21 installed and it also has jython as part of its installation (WLST). Is there a way to run jython code without having to initialize the WLST first? I have the following jars too if they bring in any ideas: ['.', '/opt/weblogic921/weblogic92/common/lib/jython.jar', '/opt/weblogic921/weblogic92/common/lib/config.jar', '/opt/weblogic921/weblogic92/common/lib/config.jar', '/opt/weblogic921/weblogic92/server/lib/weblogic.jar', '/opt/weblogic921

Memory Limit for Jython

ぐ巨炮叔叔 提交于 2019-12-07 18:21:23
问题 How can I set the JVM memory limit (-Xmx option for Java) for my Jython program? I understand that Jython 2.5 introduces the -J option in order to send options to the JVM: jython -J-Xmx8000m However, I have to work with Jython 2.2a0 on java1.6.0_23 , which does not have that option. 回答1: You could just edit jython.bat (windows) or jython (Linux) and add it. "C:\...\java.exe" -Dpython.home="C:\..." -classpath "C:\... to "C:\...\java.exe" -Xmx1024m -Dpython.home="C:\..." -classpath "C:\... 回答2:

Using multiprocessing 2.6.2.1 package in Jython

自闭症网瘾萝莉.ら 提交于 2019-12-07 12:46:26
问题 I'm new to Jython/Python world. I'm trying to install the multiprocessing package in Jython. However I'm getting following return message from the easy_install Setup script exited with error: Compiling extensions is not supported on Jython Is there any way I can install this package in Jython? 回答1: You can't use it if multiprocessing requires C extensions i.e., if you can't disable them and the module was not reimplemented for Jython in Java/pure Python. multiprocessing module is included in

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

主宰稳场 提交于 2019-12-07 12:19:35
问题 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 error=2, The system cannot find the file specified') First, my environment is: Windows 2008 JDK 1.6.0u10 jython 2.2.1 I did some digging, and I realized that this message is

Jython: subprocess.Popen runs out of file descriptors

江枫思渺然 提交于 2019-12-07 11:03:11
问题 I'm using the Jython 2.51 implementation of Python to write a script that repeatedly invokes another process via subprocess.Popen and uses PIPE to pipe stdout and stderr to the parent process and stdin to the child process. After several hundred loop iterations, I seem to run out of file descriptors. The Python subprocess documentation mentions very little about freeing file descriptors, other than the close_fds option, which isn't described very clearly (Why should there be any file

Unresolved import org.python / working with jython and java?

早过忘川 提交于 2019-12-07 11:02:29
问题 I'm using Eclipse and I"m trying to create a java program that can run my python code. I'm following the guidelines on this page: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications But when I include these statements at the top: package org.jython.book.util; import org.python.core.PyObject; import org.python.core.PyString; import org.python.util.PythonInterpreter; I receive a message saying "The import org.python cannot be

Python requires a GIL. But Jython & IronPython don't. Why?

主宰稳场 提交于 2019-12-07 05:02:36
问题 Why is it that you can run Jython and IronPython without the need for a GIL but Python (CPython) requires a GIL? 回答1: Parts of the Interpreter aren't threadsafe, though mostly because making them all threadsafe by massive lock usage would slow single-threaded extremely (source). This seems to be related to the CPython garbage collector using reference counting (the JVM and CLR don't, and therefore don't need to lock/release a reference count every time). But even if someone thought of an

Standalone Jython: Import Error (Apache-POI)

左心房为你撑大大i 提交于 2019-12-07 04:53:07
问题 Jython standalone jar is throwing the ImportError exception at the time that I try to use Jython alongside Apache-POI. Below you'll find how I call my Jython script: java -cp C:\jAutoMailerScript\lib\poi-3.9-20121203.jar -jar jython.jar main.py Error: Traceback (most recent call last): File "main.py", line 32, in from org.apache.poi.hssf.usermodel import * ImportError: No module named apache This is the code at line#32: from org.apache.poi.hssf.usermodel import * Is there any restriction from