I'm trying to use the pyodbc package on Sikuli IDE, but I'm running into some issues because it seems that Sikuli cannot identify pyd files.
I placed the pyd file in the Sikulix\Lib folder, but when I try to import it, I keep getting the message "No module named pyodbc".
with SikuliX (since it is jython/java based) only pure python language modules or modules ported to Jython can be used.
Modules like pyodbc contain C-based stuff or depend on native libs - not posible to use with SikuliX
RaiMan (developer of SikuliX)
Related
I'm using the latest IntelliJ IDEA Community IDE with the latest Python plugin to edit Jython code. In the IDE I can edit and run pure Python code using the Jython runtime installed on the machine.
However when I import a java class, the IntelliJ IDE marks the elements in the import statement as "unresolved references". But the code itself correctly runs.
Is there anyway to convince the IntelliJ syntax highlighting that this is valid Jython code?
One solution to my issue was to install the Jython Helper plugin (also on Github). This plugin creates stub files for any Java class that is referenced by a Jython program. Once the stub files are created then the red lines go away. But as I have already proved, the red lines are not an impediment to actually running the code.
Note that I am not associated with this plugin, I only discovered it after posting my question.
I am using netbeans 8.2 with python plugin 8.1. I want to code in jython with using biopython library.
Kindly tell me whether it's possible or not if so than how ?
As far as I see, Biopython libraries are libraries written for Python (and so, in C, C++ or FORTRAN).
You cannot run them directly from Jython because Jython is "Python for Java" - a project where Python language was re-implemented. Jython Documentation mentions:
Unlike the CPython distribution, Jython does not include built-in libraries written in C as they will not work on the Java platform. Instead, there are certain libraries that have been re-written in the Java languages to be included with Jython
But if you also have a Python interpreter installed on your machine, you could run your Python interpreter via commandline. You could also think about invoking Python interpreter via Java exec command from your Jython project, and collect the result, to provide it in a way that you can continue in Jython after fetching the result from Python.
I know that how we can use Sikuli in Java. But I have some code in Python which is automating a web application, and I want to use Sikuli in it. I searched a lot on the Internet about how we can use Sikuli in Python. But I did not find any good resource related to it.
How can I import Sikuli script in a Python project in Eclipse? When I added the sikuli-script.jar file in the Python path in Eclipse and when I am trying to use
import * from sikuli
Then I am getting "there is no such type of module named sikuli".
Sikuli is a tool written in Java and hence you can't use it in your Python code as is. Instead you have the option to use it within a Jython environment, that provides you the Python syntax and enables running jar packages. If you are not using many third party Python libraries and mainly stick to the generic functionality, you shouldn't get into too much trouble transferring from pure Python to Jython.
There are clear instructions of how to use Sikuli with Jython on SikuliX official website. If you have any related questions, you can post the here.
There are some Selenium commands that I am unable to use in a script that I'm writing and I do not have any idea as to whether I am missing an import of required library files or packages.
For example - selenium.browserbot, selenium.waitForElementPresent.
I am using Selenium IDE to record the script and working in Eclispe Junit platform.
Use isElementPresent instead of waitForElementPresent.
I have a Maven module, that depends on various other Maven dependencies by which I am accessing through my jython code.
I am now done, and I would like to compile the project as a .jar, or even just run it without compiling, but I have no clue where to start.
Does anyone have any idea how I can run some .py files that accesses some Java libraries in other packages?
Also, how can I compile it as a .jar file when all is done and good?
Thanks!
Compiling and integrating python
Use the jython-compile-maven-plugin. It allows you to deploy a standalone project that includes jython with libraries.
For demonstration of this plugin, see the demo project and its source code. It shows how to
launch a python console -- look at AbstractInitJython and InitJython on how to launch a python/jython console, how to execute python code snippets, and how to run a python script.
include python libraries -- the plugin also downloads and bundles python libraries (using easy_install) in the package phase, and adds them to the jar. The resulting jar can have all the libraries of the project, all pom dependencies and all the python libraries requested. The demo project shows this with the "nose" python library (see the pom file).
Testing python / jython code
The python-test-maven-plugin allows you to run your python tests alongside the normal junit tests. The demo project (look at the source at source code) shows the use of standard python unit tests (with nose) and BDD (behaviour testing) with the lettuce-clone freshen.
The sourceforge umbrella project is http://mavenjython.sourceforge.net/
Unlike maven-jython-plugin, they don't use the outdated jythonc compiler.
I am now done, and I would like to compile the project as a .jar,
It looks like there is a maven-jython-plugin allowing to compile jython source files to Java class files.
I've kinda figured out my answer to this. I shouldn't have tried to compile it, but instead wrap the python code with Java: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
The compiler portion of jython, jythonc, is deprecated as of 2.5 -- http://wiki.python.org/jython/ReplaceJythonc -- a replacement is in the works.