Exception in thread "main" ImportError: No module named __run__

Asked by Theofanis Vlachos

Hello,

I am trying to run a sikuli script in the cmd. I have it in .jar format. I am typing:

java -jar "name of script"_sikuli.jar

and I'm getting this error:

Exception in thread "main" ImportError: No module named __run__

Any ideas how to solve this?

Thanks!

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

How did you create that "script"-jar?

Revision history for this message
Theofanis Vlachos (fanisvl) said :
#2

I have version 1.1.2 so I went to File-> Export as runnable jar.

I also tried creating the script using the command: java -jar sikulixsetup-1.1.2-....jar scriptjar <path-to-your-script> and when I am trying to run it I get a different error.

Exception in thread "main" Traceback (most recent call last):
  File "__pyclasspath__/__run__$py.class", line 2, in <module>
  File "C:\Users\fvlachos\AppData\Roaming\Sikulix\Lib\sikuli\__init__.py", line 6, in <module>
    from Sikuli import *
  File "C:\Users\fvlachos\AppData\Roaming\Sikulix\Lib\sikuli\Sikuli.py", line 20, in <module>
    import subprocess
  File "C:\Users\fvlachos\AppData\Roaming\Sikulix\Lib\subprocess.py", line 400, in <module>
    import threading
  File "C:\Users\fvlachos\AppData\Roaming\Sikulix\Lib\threading.py", line 9, in <module>
    from _threading import Lock, RLock, Condition, _Lock, _RLock, _threads, _active, _jthread_to_pythread, _register_thread, _unregister_thread
ImportError: cannot import name _threads

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Sorry, but the feature is no longer supported and even switched off in 1.1.4

Revision history for this message
Theofanis Vlachos (fanisvl) said :
#4

So, is there any other way to run the script without installing SikuliX?

Revision history for this message
RaiMan (raimund-hocke) said :
#5

Sorry, no currently.

... but with 1.1.4, there is no longer a setup needed.

If you want to run scripts, you need a valid Java and have to download 2 jars.

If you create your workflows with Java code, you could pack your own complete runnable jar (be aware: the resulting jar would be up to 80MB!)

Revision history for this message
RaiMan (raimund-hocke) said :
#6

There should be another entry in the File menu: Export as jar

This creates a jar, that contains the compiled sources and the images and can be run with plain Jython having sikulixapi.jar on the class path at runtime.
jyton -jar your script.jar

another option (not having a Jython environment installed) (only supported with 1.1.4)
java -cp sikulixapi.jar:jython-standalone.jar org.python.util.jython -jar your script.jar

the mentioned jars can be found in the SikuliX environment

... and another option is:
run this sikuli script from command line:
load(<path-to-your-script-jar>)
import __run__

Can you help with this problem?

Provide an answer of your own, or ask Theofanis Vlachos for more information if necessary.

To post a message you must log in.