jython

Best method for managing Jython packages

﹥>﹥吖頭↗ 提交于 2019-12-06 13:15:30
I'm building a Jython program in PyDev and in the process have found need for some packages that are not standard for Jython 2.5 but that are standard for CPython 2.7. To this point, I've been using python's easy_install and incorrectly pointing PyDev to /usr/lib/python2.7/dist-packages. While incorrect, this has worked for the past few months until today when I encountered this problem ; one of the Python 2.7 libs taking prescient over a Jython lib and causing havok. My question is two-fold: What is the proper way to package libraries for Jython. Is it as simple as virtual-env + easy_install?

Bundling python files inside jar for access via jython

删除回忆录丶 提交于 2019-12-06 08:08:55
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 the script in string using getResourceAsStream method from ClassLoader class wont work for me as my

Jython webapp performance

喜你入骨 提交于 2019-12-06 07:27:57
问题 I'm currently building a Jython web app but am concerned about Jython application performance. I take some comfort in that any compute intensive tasks I can write in a separate Java jar and invoke them from Jython. Has anyone had problems doing this, or forsee issues with such a setup? 回答1: You'll find a nice comparison here: http://blog.dhananjaynene.com/2008/07/performance-comparison-c-java-python-ruby-jython-jruby-groovy/ Jython is slower, but depending on what you want to do, that may not

Jython: ImportError: No module named multiarray

一个人想着一个人 提交于 2019-12-06 06:31:54
When I try to call file and its method using Jython it shows the following error, while my Numpy, Python and NLTK is correctly installed and it works properly if I directly run directly from the Python shell File "C:\Python26\Lib\site-packages\numpy\core\__init__.py", line 5, in <module> import multiarray ImportError: No module named multiarray The code that I am using is simple one: PyInstance hello = ie.createClass("PreProcessing", "None"); PyString str = new PyString("my name is abcd"); PyObject po = hello.invoke("preprocess", str); System.out.println(po); When I run only the file of python

Using Pig and Python

廉价感情. 提交于 2019-12-06 05:34:47
问题 Apologies if this question is poorly worded: I am embarking on a large scale machine learning project and I don't like programming in Java. I love writing programs in Python. I have heard good things about Pig. I was wondering if someone could clarify to me how usable Pig is in combination with Python for mathematically related work. Also, if I am to write "streaming python code", does Jython come into the picture? Is it more efficient if it does come into the picture? Thanks P.S: I for

Combine JavaFX with Python

时光毁灭记忆、已成空白 提交于 2019-12-06 04:39:13
问题 I was wondering if it is possible to design a GUI using JavaFX and afterwards combining with some Python code (for example make a button using JavaFX and then write handler code in Python to give some functionality). JavaFX is great to design a really good GUI and I need Python to control a robot (the libraries are only available in Python). I had a look over the web and I found Jython , but I could not understand if it will allow me to use these third parties Python libraries. Does anyone

Jython does not load PYTHONPATH into sys.path

爱⌒轻易说出口 提交于 2019-12-06 04:02:21
问题 According to what I've read, sys.path should be set by PYTHONPATH. In Python, it works that way, but not in Jython. I can circumvent with -Dpython.path=... but I'd like to know why Jython isn't playing nicely. qa@Scantron:/tmp/pip-build-qa/robotframework> echo $PYTHONPATH /usr/lib64/python2.7 qa@Scantron:/tmp/pip-build-qa/robotframework> jython Jython 2.2.1 on java1.7.0_17 Type "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path ['', '/usr/share/jython/Lib',

wsadmin + jython restart WAS appserver

两盒软妹~` 提交于 2019-12-06 02:26:10
问题 Is it possible to stop/start WAS appserver using wsadmin (jacl/jython). I want to detele all caches on profile and then restart WAS appserver. I'm using wsadmin as standalone. 回答1: From wsadmin you may issue a command (using Jython): AdminControl.invoke(AdminControl.queryNames('WebSphere:*,type=Server,node=%s,process=%s' % ('YourNodeName', 'YourServerName')), 'restart') works with WAS Base & ND. With ND you have another option: AdminControl.invoke(AdminControl.queryNames('WebSphere:*,type

How do I catch SocketExceptions in MonkeyRunner?

断了今生、忘了曾经 提交于 2019-12-06 01:52:54
问题 When using MonkeyRunner, every so often I get an error like: 120830 18:39:32.755:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice] Unable to get variable: display.density 120830 18:39:32.755:S [MainThread] [com.android.chimpchat.adb.AdbChimpDevice]java.net.SocketException: Connection reset From what I've read, sometimes the adb connection goes bad, and you need to reconnect. The only problem is, I'm not able to catch the SocketException . I'll wrap my code like so: try: density = self

Robocode + Python

爱⌒轻易说出口 提交于 2019-12-06 01:48:03
The question is, how do you make a robot for Robocode using Python? There seem to be two options: Robocode + Jython Robocode for .NET + Iron Python There's some info for the first, but it doesn't look very robust, and none for the latter. Step by step, anyone? As long as your java-class extends robocode.Robot everything is recognized as robot. It doesn't matter where you put the class. 来源: https://stackoverflow.com/questions/8683501/robocode-python