sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #54789
Re: [Question #689767]: addHotkey cannot coerce 3rd argument to HotkeyListener
Question #689767 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/689767
Status: Answered => Open
Peter Zejda is still having a problem:
Hi RaiMan, thanks for the quick response!
If I remove the "from org.sikuli.script.import *" line, then I get this error:
Traceback (most recent call last):
File "C:/Users/Peter Zejda/Google Drive/home/programming/fun/skipads.sikuli/temp.py", line 7, in <module>
Env.addHotkey('f', KeyModifier.CTRL + KeyModifier.SHIFT, quitApp)
NameError: name 'Env' is not defined
Process finished with exit code -1
If I replace it with the line "from sikuli import *", then I get this error:
Traceback (most recent call last):
File "C:/Users/Peter Zejda/Google Drive/home/programming/fun/skipads.sikuli/temp.py", line 1, in <module>
from sikuli import *
ImportError: No module named sikuli
Process finished with exit code -1
I read a lot of the documents, and also the did some fair amount of Googling, and also tried many variations, and that's how I eventually ended up with the "from org.sikuli.script.import *" being the closest thing that worked (at least it then recognized Env and KeyModifier). I also tried using the following lines that were suggest for a Python console in Pycharm:
import org.sikuli.script.SikulixForJython
from sikuli import *
While this seems to work well within the Console (plus an additional
couple of lines before it to print out the Python version and add the
working directory to the path), when run in the stand-alone script it
gives:
Traceback (most recent call last):
File "C:/Users/Peter Zejda/Google Drive/home/programming/fun/skipads.sikuli/temp.py", line 2, in <module>
from sikuli import *
File "C:\Users\Peter Zejda\AppData\Roaming\Sikulix\Lib\sikuli\__init__.py", line 3, in <module>
from Sikuli import *
File "C:\Users\Peter Zejda\AppData\Roaming\Sikulix\Lib\sikuli\Sikuli.py", line 88, in <module>
import org.sikuli.script.TextRecognizer as JTextOCR
java.lang.NoClassDefFoundError: net/sourceforge/tess4j/TesseractException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.python.core.Py.loadAndInitClass(Py.java:1107)
at org.python.core.Py.findClassInternal(Py.java:1042)
at org.python.core.Py.findClassEx(Py.java:1093)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:142)
at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:33)
at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:130)
at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:134)
at org.python.core.PyObject.__findattr__(PyObject.java:965)
at org.python.core.PyObject.impAttr(PyObject.java:1103)
at org.python.core.imp.import_next(imp.java:840)
at org.python.core.imp.import_logic(imp.java:905)
at org.python.core.imp.import_module_level(imp.java:970)
at org.python.core.imp.importName(imp.java:1057)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:450)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importOneAs(imp.java:1093)
at sikuli.Sikuli$py.f$0(C:/Users/Peter Zejda/AppData/Roaming/Sikulix/Lib/sikuli/Sikuli.py:669)
at sikuli.Sikuli$py.call_function(C:/Users/Peter Zejda/AppData/Roaming/Sikulix/Lib/sikuli/Sikuli.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.imp.createFromCode(imp.java:436)
at org.python.core.imp.createFromSource(imp.java:396)
at org.python.core.imp.loadFromSource(imp.java:664)
at org.python.core.imp.find_module(imp.java:551)
at org.python.core.PyModule.impAttr(PyModule.java:111)
at org.python.core.imp.import_next(imp.java:840)
at org.python.core.imp.import_module_level(imp.java:957)
at org.python.core.imp.importName(imp.java:1057)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:450)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importAll(imp.java:1176)
at sikuli$py.f$0(C:/Users/Peter Zejda/AppData/Roaming/Sikulix/Lib/sikuli/__init__.py:3)
at sikuli$py.call_function(C:/Users/Peter Zejda/AppData/Roaming/Sikulix/Lib/sikuli/__init__.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.imp.createFromCode(imp.java:436)
at org.python.core.imp.createFromSource(imp.java:396)
at org.python.core.imp.loadFromSource(imp.java:664)
at org.python.core.imp.find_module(imp.java:551)
at org.python.core.imp.import_next(imp.java:838)
at org.python.core.imp.import_module_level(imp.java:957)
at org.python.core.imp.importName(imp.java:1057)
at org.python.core.ImportFunction.__call__(__builtin__.java:1280)
at org.python.core.PyObject.__call__(PyObject.java:450)
at org.python.core.__builtin__.__import__(__builtin__.java:1232)
at org.python.core.imp.importAll(imp.java:1176)
at org.python.pycode._pyx0.f$0(C:/Users/Peter Zejda/Google Drive/home/programming/fun/skipads.sikuli/temp.py:12)
at org.python.pycode._pyx0.call_function(C:/Users/Peter Zejda/Google Drive/home/programming/fun/skipads.sikuli/temp.py)
at org.python.core.PyTableCode.call(PyTableCode.java:171)
at org.python.core.PyCode.call(PyCode.java:18)
at org.python.core.Py.runCode(Py.java:1614)
at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:296)
at org.python.util.jython.run(jython.java:362)
at org.python.util.jython.main(jython.java:142)
Caused by: java.lang.ClassNotFoundException: net.sourceforge.tess4j.TesseractException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 58 more
java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: net/sourceforge/tess4j/TesseractException
Process finished with exit code -1
I also have the following environment variables set up, though I'm not sure they are all necessary:
CLASSPATH=C:\non-installed\SikulixIDE204\sikulixapi-2.0.4.jar
JYTHONPATH=C:\non-installed\jython2.7.1\bin
JYTHON_HOME=C:\non-installed\jython2.7.1
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.