← Back to team overview

sikuli-driver team mailing list archive

[Question #255035]: I can't get 1.1.0 nightly sikulixapi working within PyCharm

 

New question #255035 on Sikuli:
https://answers.launchpad.net/sikuli/+question/255035

I'm trying to use PyCharm  for the latest build of 1.1.0. I've got a small program which highlights an area of the screen which executes properly in the Sikuli IDE.  (I'm only dumping the environment, path, etc for debugging purposes)

import os
import sys

cwd = os.getcwd()
if cwd:
    print "cwd: %s" % (cwd)
    print "env:"
    for e in os.environ:
        print "\t%s=%s" % (e, os.environ[e])

    if not cwd in sys.path:
        sys.path.insert(1, cwd)
        print "added path: %s" % (cwd)
    _SX_DIR = r'c:\users\pierreb\downloads\sx110-140925'
    print "sys.path: [\n\t%s\n]" % ("\n\t".join(["{0}".format(dir_path) for dir_path in sys.path if dir_path]))
    from java.lang import ClassLoader
    cl = ClassLoader.getSystemClassLoader()
    class_path = map(lambda url: url.getFile(), cl.getURLs())
    print "classpath: %s" % class_path

from sikuli import Screen
from sikuli import Region

if __name__ == '__main__':
    import org.sikuli.script.SikulixForJython

r = Region(200,200,300,300)
r.highlight(5)


When I run it in PyCharm it fails with the following error. Any help would be appreciated

C:\Apps\jython\2.7b3\jython.bat -Dsikuli.Debug=3 "-Dpython.path=C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev;C:\Users\pierreb\Downloads\sx110-140925\sikulixapi.jar;C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm;C:\Users\pierreb\PycharmProjects\first;C:\Users\pierreb\Downloads\sx110-140925\Lib;C:\Users\pierreb\Downloads\sx110-140925\libs" "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 53565 --file C:/Users/pierreb/PycharmProjects/first/pp/simple.py
pydev debugger: process 8168 is connecting

Connected to pydev debugger (build 135.1057)
cwd: C:\Users\pierreb\PycharmProjects\first\pp
env:
	PATH=C:\ProgramData\Oracle\Java\javapath;C:\Apps\oracle\product\12.1.0\client_1;C:\Apps\oracle\product\12.1.0\client_1\bin;C:\apps\oracle\product\12.1.0\dbhome_2\bin;C:\apps\client\pierreb\product\12.1.0\client_1\bin;C:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Apps\chocolatey\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\Java\jre8\bin;C:\Apps\apache-maven-3.1.1\bin;C:\Apps\bin;C:\Program Files (x86)\Notepad++;C:\Program Files (x86)\LLVM\bin
	SYSTEMDRIVE=C:
	PROCESSOR_LEVEL=6
	_PERCENT=%
	_JAVA_MEM=-Xmx512m
	FP_NO_HOST_CHECK=NO
	SESSIONNAME=Console
	ALLUSERSPROFILE=C:\ProgramData
	PROCESSOR_ARCHITECTURE=x86
	_CP="C:\Apps\jython\2.7b3"\jython.jar
	VS100COMNTOOLS=c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\
	MAVEN_HOME=C:\Apps\apache-maven-3.1.1
	PROGRAMFILES=C:\Program Files (x86)
	PSMODULEPATH=C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\PowerShell\Modules\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\
	PROGRAMDATA=C:\ProgramData
	USERNAME=pierreb
	JDK_HOME=C:\Program Files (x86)\Java\jdk1.8.0_20
	PYCHARM_HOSTED=1
	PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
	PROCESSOR_ARCHITEW6432=AMD64
	_EXCLAMATION=!
	_JAVA_CMD="C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java"
	JYTHONPATH=C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev;C:\Users\pierreb\Downloads\sx110-140925\sikulixapi.jar;C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm;C:\Users\pierreb\PycharmProjects\first;C:\Users\pierreb\Downloads\sx110-140925\Lib;C:\Users\pierreb\Downloads\sx110-140925\libs
	WINDIR=C:\WINDOWS
	HOMEPATH=\
	PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel
	PUBLIC=C:\Users\Public
	AMDAPPSDKROOT=C:\Program Files (x86)\AMD APP\
	=::=::\
	_FULL_CMD="C:\Program Files (x86)\Java\jdk1.8.0_20\bin\java"  -Xmx512m -Xss1152k -Dpython.home="C:\Apps\jython\2.7b3" -Dpython.executable="C:\Apps\jython\2.7b3\jython.bat"  -classpath "C:\Apps\jython\2.7b3\jython.jar" org.python.util.jython   -Dsikuli.Debug=3 "-Dpython.path=C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev;C:\Users\pierreb\Downloads\sx110-140925\sikulixapi.jar;C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm;C:\Users\pierreb\PycharmProjects\first;C:\Users\pierreb\Downloads\sx110-140925\Lib;C:\Users\pierreb\Downloads\sx110-140925\libs" "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 53565 --file C:/Users/pierreb/PycharmProjects/first/pp/simple.py 
	_JYTHON_HOME="C:\Apps\jython\2.7b3"
	LOCALAPPDATA=C:\Users\pierreb\AppData\Local
	_JAVA_STACK=-Xss1152k
	_JYTHON_ARGS= -Dsikuli.Debug=3 "-Dpython.path=C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev;C:\Users\pierreb\Downloads\sx110-140925\sikulixapi.jar;C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm;C:\Users\pierreb\PycharmProjects\first;C:\Users\pierreb\Downloads\sx110-140925\Lib;C:\Users\pierreb\Downloads\sx110-140925\libs" "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py" --multiproc --client 127.0.0.1 --port 53565 --file C:/Users/pierreb/PycharmProjects/first/pp/simple.py
	_REPLACEVAL=C:/Users/pierreb/PycharmProjects/first/pp/simple.py
	COMMONPROGRAMFILES(X86)=C:\Program Files (x86)\Common Files
	JAVA_HOME="C:\Program Files (x86)\Java\jdk1.8.0_20"
	PROMPT=$P$G
	PROGRAMFILES(X86)=C:\Program Files (x86)
	=C:=C:\Users\pierreb\PycharmProjects\first\pp
	APPDATA=C:\Users\pierreb\AppData\Roaming
	PROGRAMW6432=C:\Program Files
	SYSTEMROOT=C:\WINDOWS
	CHOCOLATEYINSTALL=C:\Apps\chocolatey
	OS=Windows_NT
	JYTHON_HOME_FALLBACK="C:\Apps\jython\2.7b3"
	COMPUTERNAME=WS00079
	COMMONPROGRAMW6432=C:\Program Files\Common Files
	PYTHONIOENCODING=UTF-8
	COMMONPROGRAMFILES=C:\Program Files (x86)\Common Files
	COMSPEC=C:\WINDOWS\system32\cmd.exe
	_REPLACED=C:/Users/pierreb/PycharmProjects/first/pp/simple.py
	PROCESSOR_REVISION=3a09
	CLASSPATH=C:\Apps\jython\2.7b3\jython.jar
	IRONPYTHON_HOME=C:\Program Files (x86)\IronPython 2.7
	_CMP1=C
	_CMP2=C:
	PYTHONUNBUFFERED=1
	TEMP=C:\Users\pierreb\AppData\Local\Temp
	HOMEDRIVE=K:
	USERPROFILE=C:\Users\pierreb
	_INDEX=51
	TMP=C:\Users\pierreb\AppData\Local\Temp
	NUMBER_OF_PROCESSORS=8
	HOME=c:\users\pierreb
added path: C:\Users\pierreb\PycharmProjects\first\pp
sys.path: [
	C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev
	c:\users\pierreb\downloads\sx110-140925\libs
	c:\users\pierreb\downloads\sx110-140925\Lib
	C:\Users\pierreb\PycharmProjects\first\pp
	C:\Users\pierreb\Downloads\sx110-140925\sikulixapi.jar
	C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pycharm
	C:\Users\pierreb\PycharmProjects\first
	C:\Users\pierreb\Downloads\sx110-140925\Lib
	C:\Users\pierreb\Downloads\sx110-140925\libs
	C:\Apps\jython\2.7b3\Lib
	__classpath__
	__pyclasspath__/
]
classpath: [u'/C:/Apps/jython/2.7b3/jython.jar']
[debug] Jython: sikuli: Sikuli: starting init
[debug] ResourceLoader: SikuliX Package Build: 1.1.0 2014-09-25_09:10nightly
[error] ResourceLoader: ...: Fatal Error 101: Not possible to access the jar files!
[error] ***** Terminating SikuliX after a fatal error 101 *****
It makes no sense to continue!
If you do not have any idea about the error cause or solution, run again
with a Debug level of 3. You might paste the output to the Q&A board.
[debug] Sikulix: cleanUp: 0
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py", line 1733, in <module>
    debugger.run(setup['file'], None, None)
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py", line 1226, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:/Users/pierreb/PycharmProjects/first/pp/simple.py", line 25, in <module>
    from sikuli import Screen
  File "c:\users\pierreb\downloads\sx110-140925\Lib\sikuli\__init__.py", line 6, in <module>
    from Sikuli import *
  File "c:\users\pierreb\downloads\sx110-140925\Lib\sikuli\Sikuli.py", line 30, in <module>
    from org.sikuli.script import Screen as JScreen
java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:340)
	at org.python.core.Py.loadAndInitClass(Py.java:933)
	at org.python.core.Py.findClassInternal(Py.java:868)
	at org.python.core.Py.findClassEx(Py.java:919)
	at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:133)
	at org.python.core.packagecache.PackageManager.findClass(PackageManager.java:28)
	at org.python.core.packagecache.SysPackageManager.findClass(SysPackageManager.java:122)
	at org.python.core.PyJavaPackage.__findattr_ex__(PyJavaPackage.java:137)
	at org.python.core.PyObject.__findattr__(PyObject.java:879)
	at org.python.core.imp.importFromAs(imp.java:1044)
	at org.python.core.imp.importFrom(imp.java:1016)
	at sikuli.Sikuli$py.f$0(C:\Users\pierreb\Downloads\sx110-140925\Lib\sikuli\Sikuli.py:509)
	at sikuli.Sikuli$py.call_function(C:\Users\pierreb\Downloads\sx110-140925\Lib\sikuli\Sikuli.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:166)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:393)
	at org.python.core.imp.createFromPyClass(imp.java:209)
	at org.python.core.imp.loadFromSource(imp.java:574)
	at org.python.core.imp.find_module(imp.java:480)
	at org.python.core.PyModule.impAttr(PyModule.java:101)
	at org.python.core.imp.import_next(imp.java:739)
	at org.python.core.imp.import_module_level(imp.java:856)
	at org.python.core.imp.importName(imp.java:946)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1301)
	at org.python.core.PyObject.__call__(PyObject.java:373)
	at org.python.core.__builtin__.__import__(__builtin__.java:1254)
	at org.python.core.imp.importAll(imp.java:1066)
	at sikuli$py.f$0(C:\Users\pierreb\Downloads\sx110-140925\Lib\sikuli\__init__.py:6)
	at sikuli$py.call_function(C:\Users\pierreb\Downloads\sx110-140925\Lib\sikuli\__init__.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:166)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.imp.createFromCode(imp.java:393)
	at org.python.core.imp.createFromPyClass(imp.java:209)
	at org.python.core.imp.loadFromSource(imp.java:574)
	at org.python.core.imp.find_module(imp.java:480)
	at org.python.core.imp.import_next(imp.java:737)
	at org.python.core.imp.import_module_level(imp.java:856)
	at org.python.core.imp.importName(imp.java:946)
	at org.python.core.ImportFunction.__call__(__builtin__.java:1301)
	at org.python.core.PyObject.__call__(PyObject.java:373)
	at org.python.core.__builtin__.__import__(__builtin__.java:1254)
	at org.python.core.imp.importFromAs(imp.java:1040)
	at org.python.core.imp.importFrom(imp.java:1016)
	at org.python.pycode._pyx14.f$0(C:/Users/pierreb/PycharmProjects/first/pp/simple.py:32)
	at org.python.pycode._pyx14.call_function(C:/Users/pierreb/PycharmProjects/first/pp/simple.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:166)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1312)
	at org.python.core.__builtin__.execfile_flags(__builtin__.java:521)
	at org.python.core.__builtin__.execfile(__builtin__.java:498)
	at org.python.core.BuiltinFunctions.__call__(__builtin__.java:196)
	at org.python.core.PyObject.__call__(PyObject.java:442)
	at org.python.pycode._pyx2.run$41(C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py:1226)
	at org.python.pycode._pyx2.call_function(C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:166)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:304)
	at org.python.core.PyBaseCode.call(PyBaseCode.java:177)
	at org.python.core.PyFunction.__call__(PyFunction.java:380)
	at org.python.core.PyMethod.__call__(PyMethod.java:166)
	at org.python.pycode._pyx2.f$0(C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py:1733)
	at org.python.pycode._pyx2.call_function(C:\Program Files (x86)\JetBrains\PyCharm Community Edition 3.4.1\helpers\pydev\pydevd.py)
	at org.python.core.PyTableCode.call(PyTableCode.java:166)
	at org.python.core.PyCode.call(PyCode.java:18)
	at org.python.core.Py.runCode(Py.java:1312)
	at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:251)
	at org.python.util.jython.run(jython.java:334)
	at org.python.util.jython.main(jython.java:145)
Caused by: java.lang.NullPointerException
	at org.sikuli.script.Screen.getPrimaryScreen(Screen.java:321)
	at org.sikuli.script.Sikulix.cleanUp(Sikulix.java:193)
	at org.sikuli.script.Sikulix.terminate(Sikulix.java:174)
	at org.sikuli.basics.ResourceLoader.<init>(ResourceLoader.java:129)
	at org.sikuli.basics.ResourceLoader.get(ResourceLoader.java:135)
	at org.sikuli.basics.FileManager.loadLibrary(FileManager.java:80)
	at org.sikuli.script.Screen.<clinit>(Screen.java:56)
	... 68 more

java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError

Process finished with exit code -1


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.