Fix Failed Module Import in Sikuli Scripts

Sikuli IDE throws below error while importing the modules essentially with import subprocess

Code:

[code language=”csharp”]
import sys
import time
import subprocess
import os
[/code]

Error Message:

[info] Sikuli vision engine loaded. [info] Windows utilities loaded.
[info] VDictProxy loaded.
[error] Stopped [error] An error occurs at line 3
[error] Error message: Traceback (most recent call last):
File “C:\Users\GOVARD~1\AppData\Local\Temp\sikuli-tmp6393242728040316401.py”, line 3, in
import subprocess  File “C:\Program Files\Sikuli X\sikuli-script.jar\Lib\subprocess.py”, line 642, in
File “C:\Program Files\Sikuli X\sikuli-script.jar\Lib\subprocess.py”, line 640, in _setup_platform
File “C:\Program Files\Sikuli X\sikuli-script.jar\Lib\warnings.py”, line 56, in warn
File “C:\Program Files\Sikuli X\sikuli-script.jar\Lib\warnings.py”, line 56, in warn
IndexError: index out of range: 0

Screenshot of the same error message:

image

Environment:
Sikuli version: Sikuli X-1.0rc2
Platform: 32-bit Windows 7
Path entry: “C:\Program Files\Sikuli X\libs” in system path.

Troubleshooting:
Install Sikuli to a space less path location. Like C:\Sikuli\
Verify rest of the code in Sikuli working
Ensure Sikuli reading the environment variable values fine
Isolate it to whether it’s Sikuli or Python problem

Resolution:
Cause for the trouble:
I’ve two Python’s installed on my PC (one comes with Cygwin and other one is windows Python). Unfortunately, it’s the Cygwin python that was in the path and it expects the files to be passed in a different notation. That caused Sikuli to fail.

Fix:
Removed the Cygwin Python from my path, re-installed Windows Python and Sikuli. That’s all Sikuli on my PC started it’s performance!!!

References: https://answers.launchpad.net/sikuli/+question/150145

Leave a Reply

Your email address will not be published. Required fields are marked *