Sikuli python scripting in visual studio

Asked by mohammad

Hello,

I am new to both sikuli and visual studio. I downloaded the sikuli jar and played around with writing sikuli scripts in the sikuli IDE. I was wondering if there is a way to sikuli development in visual studio just because I prefer the environment. I see packages I can install like jython-sikuli-server, jython-sikuli-client, robotframework-SikuliLibrary etc... but still dont see anything that gives me the same programming API that the IDE does.

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

--- jython-sikuli-server, jython-sikuli-client, robotframework-SikuliLibrary
all those "libraries" have their own ecosystem and you have to check each package wether it is useful for you.
some packages out there rely on or contain SikuliX versions, that are no longer supported.

Here only the original SikuliX versions are supported (preferably the latest 1.1.4)

--- Visual Studio
I am not familiar with the features of it.
SikuliX is based on Java and hence you can write programs/scripts in other IDE's either with Java or with Java aware scripting languages (like Jython, JRuby, JavaScript, ...).
So you have to check what is possible for you in VS.

Revision history for this message
mohammad (jazarmoh) said :
#2

when adding the libraries from sikulixapi.jar from visual basic like:
  sys.path.append("C:\jython2.7.0\Lib\site-packages\sikulixapi")
  sys.path.append("C:\jython2.7.0\Lib\site-packages\sikulixapi\Lib")

after running import sikuli I get the following error:

Traceback (most recent call last):
  File "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\microsoft\python\core\ptvsd_repl_launcher.py", line 130, in <module>
    _run_repl()
  File "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\microsoft\python\core\ptvsd_repl_launcher.py", line 114, in _run_repl
    backend.execution_loop()
  File "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\microsoft\python\core\ptvsd\repl\__init__.py", line 748, in execution_loop
    exit, cur_modules, cur_ps1, cur_ps2 = self.run_one_command(cur_modules, cur_ps1, cur_ps2)
  File "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\microsoft\python\core\ptvsd\repl\__init__.py", line 672, in run_one_command
    self.execute_item = None
  File "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\microsoft\python\core\ptvsd\repl\__init__.py", line 670, in run_one_command
    self.execute_item()
  File "c:\program files (x86)\microsoft visual studio\2017\professional\common7\ide\extensions\microsoft\python\core\ptvsd\repl\__init__.py", line 645, in execute_code_work_item
    exec(code, self.exec_mod.__dict__, self.exec_mod.__dict__)
  File "<stdin>", line 1, in <module>
  File "C:\jython2.7.0\Lib\site-packages\sikulix\Lib\sikuli\__init__.py", line 6, in <module>
    from Sikuli import *
  File "C:\jython2.7.0\Lib\site-packages\sikulix\Lib\sikuli\Sikuli.py", line 31, in <module>
    RUNTIME = RunTime.get()
 at org.sikuli.script.RunTime.init(RunTime.java:635)
 at org.sikuli.script.RunTime.get(RunTime.java:385)
 at org.sikuli.script.RunTime.get(RunTime.java:194)
 at org.sikuli.script.RunTime.get(RunTime.java:407)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498)

java.lang.NullPointerException: java.lang.NullPointerException
An internal error has occurred in the Interactive window. Please restart Visual Studio.

any idea what the issue might be ? my JAVA_HOME is set to "C:\Program Files\Java\jdk1.8.0_191"

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

Make sure, to use the latest build of sikulixapi.jar (>#178)

Can you help with this problem?

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

To post a message you must log in.