Question #688198 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/688198
Paul Weber gave more information on the question:
Hi RaiMan!
I'm trying to figure out how to run the sikulix script in Pycharm correctly. I
try to repeat the steps according to your instructions -
https://sikulix-2014.readthedocs.io/en/latest/scenarios.html. For this, I
performed :
1) Download, install and run Jython-2.7.1 (C: \ Jython2.7.1 \
jython2.7.1);
2) Previously installed version of Pycharm:: 2019.1.3 (Community
Edition), Build # PC-191.7479.30; (C: \ Program Files \ JetBrains \
PyCharm Community Edition 2019.1.3 \ bin);
3) Indicated PyCharm to use Jython as an interpreter.
Settings → Progect: PycharmProjects (For current project) → Project Interpreter:
Jython 2.7 C: \ Jython2.7.1 \ jython2.7.1 \ bin \ jython.exe
At the same time, in the same window (PyCharm) you can see the connected
packages.
I have installed: Cython (0.29.14), certifi (2019.11.28), chardet (3.0.4), idna
(2.8), jip (0.9.13), pip (20.0.2), py4j (0.10.9) , requests (2.22.0),
robotframework (3.1.2), setuptools (28.8.0), urllib3 (1.25.8), wsgiref (0.1.2)
4) In PyCharm, I set up the environment for the Python console with SikuliX
support. In the Python Console window, in the Environment variables field,
added CLASSPATH:
CLASSPATH = C: \ Users \ User \ AppData \ Roaming \ Sikulix \
sikulixapi-2.0.2.jar (and for reliability, the same CLASSPATH wrote in the
Windows folders - Environment Variables: in User Environment Variables and
System Variables).
Also deactivated the “Add content roots to PYTHONPATH” and “Add source roots to
PYTHONPATH” checkboxes in the Python Console window.
5) I do not understand about the valid sikulixapi-2.0.2.jar? I downloaded the
file “sikulixapi-2.0.2.jar” from the site
https://raiman.github.io/SikuliX1/downloads.html and installed it in the root
of the folder where the sikulixide-2.0.2 file was installed (C: \ Users \ User
\ AppData \ Roaming \ Sikulix).
In the Python Console window, in the Starting script field, I wrote two lines:
import org.sikuli.script.SikulixForJython
and from sikuli import *.
6) In PyCharm, in the tab Run → Edit Configurations ... → (+) Add New
Configuration → Python →
prescribed Script path: C: \ Users \ User \ PycharmProjects \ testuc2 \
testuc2.py →
prescribed Environment variables: PYTHONUNBUFFERED = 1; CLASSPATH = C: \ Users
\ User \ AppData \ Roaming \ Sikulix \ sikulixapi-2.0.2.jar →
prescribed Python interpreter: Jython 2.7 C: \ Jython2.7.1 \ jython2.7.1 \ bin
\ jython.exe →
prescribed the Working directory: C: \ Users \ User \ PycharmProjects \ testuc2
The "Add content roots to PYTHONPATH" and "Add source roots to PYTHONPATH"
checkboxes are also deactivated.
7) However, I encountered problems when running the sikuli script (the script
is from here https://answers.launchpad.net/sikuli/+question/686680).
Firstly, when creating a new project, the following error was displayed:
New jython executable in
C:\Users\User\PycharmProjects\testuc2\venv\bin\jython.exe
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState
(file:/C:/Jython2.7.1/jython2.7.1/jython.jar) to method
java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of
org.python.core.PySystemState
WARNING: Use --illegal-access=warn to enable warnings of further illegal
reflective access operations
WARNING: All illegal access operations will be denied in a future release
Traceback (most recent call last):
File
"C:\Users\User\AppData\Local\Temp\tmp9exvvepycharm-management\virtualenv-16.4.3\virtualenv.py",
line 2567, in
main()
File
"C:\Users\User\AppData\Local\Temp\tmp9exvvepycharm-management\virtualenv-16.4.3\virtualenv.py",
line 783, in main
create_environment(
File
"C:\Users\User\AppData\Local\Temp\tmp9exvvepycharm-management\virtualenv-16.4.3\virtualenv.py",
line 1070, in create_environment
py_executable = os.path.abspath(
File
"C:\Users\User\AppData\Local\Temp\tmp9exvvepycharm-management\virtualenv-16.4.3\virtualenv.py",
line 1601, in install_python
os.symlink(py_executable_base, full_pth)
AttributeError: 'module' object has no attribute 'symlink'
Secondly, when you run this script
(https://answers.launchpad.net/sikuli/+question/686680), which runs fine
in SikuliXIDE2.0.2, another Error and Warning is displayed:
C:\Jython2.7.1\jython2.7.1\bin\jython.exe -Dpython.path=
C:/Users/User/PycharmProjects/testuc2/testuc2.py
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.python.core.PySystemState
(file:/C:/Jython2.7.1/jython2.7.1/jython.jar) to method
java.io.Console.encoding()
WARNING: Please consider reporting this to the maintainers of
org.python.core.PySystemState
WARNING: Use --illegal-access=warn to enable warnings of further illegal
reflective access operations
WARNING: All illegal access operations will