ImportError: no module named sikuli --- sikulixapi.jar not on Java classpath
I am getting an error when I attempt to run a python script (jython dak2.py). I've tried for a while to get to the bottom of this, to no avail and don't know what to do next. Any ideas?
I’m running CentOS release 7.5 on a VMWare Workstation VM and Sikuli 1.1.4
I’m able to run the SikuliIDE and created a sample script where I’m able to execute multiple commands on the CentOS desktop
I’ve saved the script off to a folder (/home/
I want to run the python script (dak2.py) from the command line
I’ve edited the python script and added the following 2 lines to the top of the file
import org.sikuli.
from sikuli import *
when I run the command “jython dak2.py” I get an error:
Traceback (innermost last):
File “dak2.py”, line 1 in ?
ImportError: no module named sikuli
Thanks in advance
Question information
- Language:
- English Edit question
- Status:
- Expired
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Revision history for this message
|
#1 |
the intro statements for standalone .py scripts is
import org.sikuli.
from sikuli import *
... and sikulixapi.jar has to be on the classpath.
sorry, but the docs for that are a bit hidden ;-)
https:/
For running scripts from commandline simply use this command:
java -jar <path-to>
for the available parameters see:
https:/
Revision history for this message
|
#2 |
RaiMan,
Thanks for the speedy reply. I would like to use python to execute the scripts, extending what is generated by Sikuli during the save process as it packages/includes the .py and .png files. I'm currently running the command "jython dak2.py" which is generating the ImportError. Is it possible to run the python script to execute sikuli?
David
Revision history for this message
|
#3 |
--- Is it possible to run the python script to execute sikuli?
... yes, but at least this has to be obeyed (see comment #1)
the intro statements for standalone .py scripts is
import org.sikuli.
from sikuli import *
... and sikulixapi.jar has to be on the classpath.
... and finally you have to solve the "where are the images loaded from" problem (imagePath).
--- extending what is generated by Sikuli during the save process
not sure what you mean by that?
Revision history for this message
|
#4 |
RaiMan,
Thanks, you have been very patient with me and I appreciate it. I am trying to run the python code, in this case dak2.py, that gets created when you save from the IDE. I have set the classpath properly (a linux which sikuli.
David
From: RaiMan <email address hidden>
To: <email address hidden>
Sent: Friday, December 7, 2018 3:57 AM
Subject: Re: [Question #676645]: ImportError: no module named sikuli
Your question #676645 on Sikuli changed:
https:/
Status: Open => Answered
RaiMan proposed the following answer:
the intro statements for standalone .py scripts is
import org.sikuli.
from sikuli import *
... and sikulixapi.jar has to be on the classpath.
sorry, but the docs for that are a bit hidden ;-)
https:/
For running scripts from commandline simply use this command:
java -jar <path-to>
for the available parameters see:
https:/
--
If this answers your question, please go to the following page to let us
know that it is solved:
https:/
If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https:/
You received this question notification because you asked the question.
Revision history for this message
|
#5 |
please paste your relevant environment settings for Jython and Java.
How do you run the script exactly?
is the Jython/bin on path?
Again: why do you do that? why don't you use the features of SikuliX?
Revision history for this message
|
#6 |
RaiMan,
I execute the script from the command line via jython dak2.py.
I want to remote into a box and kick off the python script to run the test that executes a GUI.
I ran typescript to capture the settings, commands and output from the session, see below - I hope this helps
-------
[admin@RFC1918 ~]$ who am i
admin pts/10 2018-12-10 08:50
[admin@RFC1918 ~]$ pwd
/home/admin
[admin@RFC1918 ~]$ ls -l
total 4380
drwxr-xr-x. 2 admin admin 6 Nov 30 09:33 Desktop
drwxr-xr-x. 2 admin admin 6 Nov 30 09:33 Documents
drwxr-xr-x. 5 admin admin 192 Dec 7 15:26 Downloads
rw-rw-r--. 1 admin admin 0 Dec 10 08:50 for_raiman
drwxr-xr-x. 9 root root 107 Nov 30 10:04 jdk-10.0.2
drwxr-xr-x. 2 admin admin 6 Nov 30 09:33 Music
drwxrwxr-x. 4 admin admin 91 Dec 1 11:18 opencv_extra
drwxr-xr-x. 2 admin admin 53 Dec 3 08:41 Pictures
drwxr-xr-x. 2 admin admin 6 Nov 30 09:33 Public
lrwxrwxrwx. 1 admin admin 6 Dec 9 12:19 sikuli -> Sikuli
drwxrwxrwx. 6 admin admin 112 Dec 10 08:24 Sikuli
-rw-rw-r--. 1 admin admin 4476928 Dec 2 13:42 sikuli_install
drwxrwxr-x. 2 admin admin 123 Dec 3 06:13 Sikuli.sikuli
drwxr-xr-x. 2 admin admin 6 Nov 30 09:33 Templates
-rw-rw-r--. 1 admin admin 2570 Dec 10 08:22 typescript
drwxr-xr-x. 2 admin admin 6 Nov 30 09:33 Videos
[admin@RFC1918 ~]$ cd sikuli
[admin@RFC1918 sikuli]$ echo $PATH
/usr/admin/
[admin@RFC1918 sikuli]$ echo $CLASSPATH
/usr/admin/
[admin@RFC1918 sikuli]$ ls -l
total 178244
drwxrwxr-x. 2 admin admin 146 Dec 10 05:15 dak2.sikuli
drwxrwxrwx. 7 admin admin 194 Dec 10 04:46 scripts
-rw-rw-r--. 1 admin admin 89065892 Nov 30 10:05 sikulixapi.jar
-rw-rw-r--. 1 admin admin 93451308 Nov 30 10:06 sikulix.jar
drwxrwxr-x. 4 admin admin 79 Dec 6 05:09 testing
drwxrwxr-x. 3 admin admin 49 Dec 7 15:27 testing1
[admin@RFC1918 sikuli]$ cd dak2.sikuli
[admin@RFC1918 dak2.sikuli]$ ls
13m154384107594
[admin@RFC1918 dak2.sikuli]$ cat dak2.py
import org.sikuli.
from sikuli import *
Region(434,334,6,4)
"""
click("
"""
click("
wait(2)
type("clear \n")
wait(2)
type("pwd \n")
wait(1)
type("ls \n")
wait(2)
type ("cd jdk-10.0.2 \n")
wait(2)
type ("ls -l \n")
wait(2)
type ("cd .. \n")
wait(2)
click("
wait(2)
click("
"""
wait(2)
waitVanish(
type("t", KeyModifier.CTRL
App.open("blah")
keyDown("a")
keyUp("a")
keyDown(
keyUp(Key.Left)
rightClick()
waitVanish()
"""
[admin@RFC1918 dak2.sikuli]$
[admin@RFC1918 dak2.sikuli]$ which java
/usr/bin/java
[admin@RFC1918 dak2.sikuli]$ which jython
/usr/local/
[admin@RFC1918 dak2.sikuli]$ jython dak2.py
Traceback (innermost last):
File "dak2.py", line 1, in ?
ImportError: no module named sikuli
[admin@RFC1918 dak2.sikuli]$
From: RaiMan <email address hidden>
To: <email address hidden>
Sent: Monday, December 10, 2018 9:46 AM
Subject: Re: [Question #676645]: ImportError: no module named sikuli
Your question #676645 on Sikuli changed:
https:/
Status: Open => Needs information
RaiMan requested more information:
please paste your relevant environment settings for Jython and Java.
How do you run the script exactly?
is the Jython/bin on path?
Again: why do you do that? why don't you use the features of SikuliX?
--
To answer this request for more information, you can either reply to
this email or enter your reply at the following page:
https:/
You received this question notification because you asked the question.
Revision history for this message
|
#7 |
[admin@RFC1918 sikuli]$ echo $CLASSPATH
/usr/admin/
This is surely not a classpath, that makes sense.
... and sikulixapi.jar is not part of it.
a Java classpath is a list jar-files and/or folders contain java class-files.
Revision history for this message
|
#8 |
RaiMan,
My apologies for being such a nube I hope this is the last question I have to ask of you. I believe I have addressed the initial issues with the classpath and am no longer receiving the previous errors. Unfortunately when I attempt to run the python script from the commandline as previously mentioned I now receive a single error - [error] RunTimeAPI: *** terminating: JythonHelper: no Jython available.
thank you for your patience.David
From: RaiMan <email address hidden>
To: <email address hidden>
Sent: Tuesday, December 11, 2018 5:02 AM
Subject: Re: [Question #676645]: ImportError: no module named sikuli
Your question #676645 on Sikuli changed:
https:/
Status: Open => Answered
RaiMan proposed the following answer:
[admin@RFC1918 sikuli]$ echo $CLASSPATH
/usr/admin/
This is surely not a classpath, that makes sense.
... and sikulixapi.jar is not part of it.
a Java classpath is a list jar-files and/or folders contain java class-
files.
--
If this answers your question, please go to the following page to let us
know that it is solved:
https:/
If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https:/
You received this question notification because you asked the question.
Revision history for this message
|
#9 |
--- I hope this is the last question ...
Surely not, believe me --- years of experience ;-)
--- [error] RunTimeAPI: *** terminating: JythonHelper: no Jython available.
... means, that the Jython Java support is not on the classpath (some jython....jar)
Since I do not understand your setup in detail, I cannot say more.
...and again: why do you do that? why don't you use the features of SikuliX to run the scripts.
Revision history for this message
|
#10 |
RaiMan,
I'm still stuck on the Jython issue. I've been trying a bunch of different things, but can't seem to get anywhere
When I attempt to run the python script from the command line I get an error - RunTimeAPI: *** terminating: JythonHelper: no jython available.
I've attached a screen grab of some of the setting and results - any ideas?
Thanks again for all the help.
David
From: RaiMan <email address hidden>
To: <email address hidden>
Sent: Wednesday, December 12, 2018 12:46 PM
Subject: Re: [Question #676645]: ImportError: no module named sikuli --- sikulixapi.jar not on Java classpath
Your question #676645 on Sikuli changed:
https:/
Status: Open => Answered
RaiMan proposed the following answer:
--- I hope this is the last question ...
Surely not, believe me --- years of experience ;-)
--- [error] RunTimeAPI: *** terminating: JythonHelper: no Jython available.
... means, that the Jython Java support is not on the classpath (some jython....jar)
Since I do not understand your setup in detail, I cannot say more.
...and again: why do you do that? why don't you use the features of
SikuliX to run the scripts.
--
If this answers your question, please go to the following page to let us
know that it is solved:
https:/
If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https:/
You received this question notification because you asked the question.
Revision history for this message
|
#11 |
no attachments here possible - send me details to
sikulix-
Revision history for this message
|
#12 |
This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.