Sikuli Command prompt Issue

Asked by Nagarjun Jammalamadaka

I'm new to this tool.When i'm trying to run from command prompt(Win Xp) i'm getting an error saying it's not recognised as internal or external command.I would like to know if there is any convenient way to pass data from an Excel file.Also can we run all Sikuli Scripts consolidatedly at one go.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

--- command line
use
Sikuli-IDE.bat -r some-script.sikuli

--- convenient way to pass data from an Excel file
either use a csv-version of the .XLS and read it as a normal file or use Python module xlrd.

--- can we run all Sikuli Scripts consolidatedly at one go
the usual way, to do this is to either use execfile() in a main script, that does the consolidation or to use the Python unitttest feature from the beginning (see https://answers.launchpad.net/sikuli/+question/182883)

Revision history for this message
Nagarjun Jammalamadaka (nagarjun-j) said :
#2

Thanks for such quick response.For Command line issue now i'm able to work on it.To run all script at a time i'll go through the Unittest feature.
But for passing data can u provide me with a sample script(from tool itself) like how to acces using CSV version because i'm not familiar with Python.

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

If you want to do some more sophisticated things with Sikuli script, you need some basic Python knowledge ;-)

example:
read a csv-file and use the content

*** csv file content
"a text", 4711, 3.017, True
"another text", 4712, 3.018, False

*** the script

csv = file("path to your csv file")
csvList = []
for line in csv.readlines():
     csvList.append(eval("[" + line.strip() + "]"))
csv.close()

print csvList # all content

print csvList[0] # first line of content

print csvList[-1][1] # last line 2nd field (4712)

*** how to use it in your script with a loop: see faq 1437

Revision history for this message
Nagarjun Jammalamadaka (nagarjun-j) said :
#4

Thanks RaiMan, that solved my question.

Revision history for this message
prabhu (prabhugentle) said :
#5

[error] Stopped [error] An error occurs at line 11 [error] Error message: Traceback (most recent call last): File "C:\Users\amd\AppData\Local\Temp\sikuli-tmp3380813867422138846.py", line 11, in csvList.append(eval("[" + line.strip() + "]")) TypeError: compile() expected string without null bytes

I am getting this error could you please help me reading a data from excel