jython

Sikuli Integrator C#

a 夏天 提交于 2019-12-20 05:44:10
问题 I want to use SikuliIntegrator in C#. I run VS as administrator, install SikuliIntegrator throught NuGet manager and want to test him on simple task. Heres my code using SikuliModule; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SikuliTrainingNet { class Program { static void Main(string[] args) { string MyPicture = @"c:\111\Sik\MyPicture.png"; SikuliAction.Click(MyPicture); } } } after running code (and have

Using UCanAccess in a Jython script invoked from the command line

旧街凉风 提交于 2019-12-20 04:08:21
问题 OS: Windows7, Jython2.7.0FR ("Final Release") Trying to use Gord Thompson's solution with Jython: Manipulating an Access database from Java without ODBC I can get the Ucanaccess module to work in Eclipse, but not when I try running from the CLI. # -*- coding: utf-8 -*- import java, sys jars_dir = 'D:\\sysadmin\\Resources\\Java jar files\\' sys.path.append( jars_dir + 'commons-lang-2.6.jar' ) sys.path.append( jars_dir + 'commons-logging-1.2.jar' ) sys.path.append( jars_dir + 'hsqldb.jar' ) sys

How to Download a file to a specific path in the server : Python

≯℡__Kan透↙ 提交于 2019-12-20 02:45:28
问题 How to download a file through http on to a local folder on my server in jython(or python) The below code might work os.chdir("/path/to/change/to") from urllib2 import urlopen f = urlopen("http://some.server/some/directory/some.file") But for this my Current working directory is changed.I want to be in the current working directory and download the file to any given path on my Server. Any help ? 回答1: How about urllib.urlretrieve import urllib urllib.urlretrieve('http://python.org/images

Run python script (with numpy dependency) from java

久未见 提交于 2019-12-19 11:48:26
问题 In a java application I need to use a specific image processing algorithm that is currently implemented in python. What would be the best approach, knowing that this script uses the Numpy library ? I alreayd tried to compile the script to java using the jythonc compiler but it seems that it doesn't support dependencies on native libraries like Numpy. I also tried to use Jepp but I get an ImportError when importing Numpy, too. Any suggestion ? 回答1: If you're using Numpy you probably have to

How can I use jython setup.py install?

ぃ、小莉子 提交于 2019-12-19 11:18:35
问题 I am using a Jython virtualenv where I can install whatever software via pip or via easy_install, but there is a software that is not registered yet and the installation mode via: [sudo] python setup.py install and I am trying to do the same with jython: [sudo] jython setup.py install So, I am getting these follow errors: Traceback (most recent call last): File "setup.py", line 3, in <module> from setuptools import setup, find_packages ImportError: No module named setuptools I checked and

creating executable for jython scripts

你。 提交于 2019-12-19 09:03:08
问题 for python scripts i was using py2exe to create executable file. Is there any way to create either .exe or .jar file for jython script? 回答1: Sharing how I achieve this. Thanks to EnigmaCurry for providing the framework. Jar Method from Jython wiki works quite well. The one drawback that it has is that all of the Java dependancies need to be exploded into the main jar root. This gets messy very quickly. So the approach uses One-Jar. It is a special class loader which can load a jar from

Packaging and deploying a Jython program from Eclipse

狂风中的少年 提交于 2019-12-19 04:15:23
问题 So I've been pigeon-holed into writing some Jython code. I've been using the latest version of Eclipse IDE with the PyDev plugin for development. Up until now, things have been moderately tolerable. I've gotten all my Python scripts working and I'm successfully including a couple of JAR files and the class directory of another Java project as external dependencies. Everything seems to run fine through the Eclipse IDE. Now I need to package everything up and deploy it. From what I can gather,

What's the best way to deploy a Flask app using Jython on Tomcat?

谁说胖子不能爱 提交于 2019-12-18 15:36:10
问题 I successfully deployed the demo web app that comes with Jython. It uses modjy which is a Jython WSGI gateway. I'm now trying to hook modjy to my Flask app. I get a handler not defined error. The full traceback is here: http://pastie.org/2810227 回答1: There are two different ways you can specify an application to modjy: Using the app_import_name mechanism Using a combination of app_directory/app_filename/app_callable_name For the first method simply create a file that imports your Flask app

Why must “exec” (and not “eval”) be used for Python import statements?

自作多情 提交于 2019-12-18 12:23:25
问题 I'm trying to run a snippet of Python from within Java, using Jython. If I use an exec statement to import, everything works. PythonInterpreter pi = new PythonInterpreter(); pi.exec("import re"); PythonObject o = pi.eval("re.match('abc', 'abc123')"); // returns a MatchObject o = pi.eval("re.match('abc', 'def123')"); // returns Py.None If, however, I try to combine the two lines, all hell breaks loose. This: PythonInterpreter pi = new PythonInterpreter(); pi.eval("import re"); // exception!

Problem with Jython urllib2.urlopen for HTTPS pages

吃可爱长大的小学妹 提交于 2019-12-18 08:58:28
问题 I have a python program using urllib2 to GET a page via https protocol: urllib2.urlopen('https://mywebsite') I have no problem running this script using python interpreter, but when running with Jython interpreter, I got this error: urllib2.URLError: <urlopen error (-1,'SSL handshake exception')> Do I need to do something else to make urllib2.urlopen work with an https address? 回答1: I think Jython use the Java SSL implementation, so you'll need to add the server's certificate to your keystore