How to pass strings from a python script to Sikuli script?

Asked by teste

Hello, I have a Python script constantly scraping some pages and would like to pass the strings to a running SikuliX script that will use the data.
Is that possible? If yes, how can I do that?

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
masuo (masuo-ohara) said :
#1

How about passing strings by a file.
Write strings to the file by your Python script, and read strings from the file by SikuliX script.

Revision history for this message
teste (vpsa) said :
#2

Hello @masuo, I thought on this method but the problem is that it needs to be "lightining fast", I think that writing and reading from a file would be too slow.

Revision history for this message
masuo (masuo-ohara) said :
#3

After you compare with scraping time and reading file time, you think so? Scraping is "lightining fast",too?

Revision history for this message
teste (vpsa) said :
#4

Yes, as it was the same script doing the work, he was scraping and storing the strings, if you need to scrap, open a file, write the string, close a file and another script picks the string in the file, yes, it will add much more time (you are adding at-least one step more to the process).

Revision history for this message
TestMechanic (ndinev) said :
#5

1. You need to define "Fast" - how fast in seconds(or ms).
2. You need to define size of string - in bytes.
3. You need to define how many strings per second you need to read
4. You need to define power of underlying machine that will do the work

If you are doing something with sikuli like image recognition I doubt file read will be slow in comparison.
My first choice will be "file" if 1-4 questions have reasonable expectations.

However You can investigate :
1. pipes - sikuli script to open pipe to python script and to read directly from the pipe.
2. simple rest server run by sikuli that will get post request send by the python script
3. mysql database

Can you help with this problem?

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

To post a message you must log in.