sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #00828
Re: [Question #142149]: Write Sikuli Var to file
Question #142149 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/142149
SkaiCloud posted a new comment:
using the method stated by Raiman will output the region variable as a
string so you would have to use the exec to execute the string.
this is one region variable:
regionfile.write("r1="+str(r1).split('@')[0].replace('Region','"Region').replace('[','(').replace(']',')"').replace(' ',',').replace('x',',')+"\n")
to read that line and convert it to a variable I use this method:
import imp
data = imp.load_source('data', '', regionfile)
r1Str="r1="+data.r1
exec(r1Str)
I'm sure their are more elite ways to do it but this is the simplist I
found.Just wanted to share how to read a file import the string from the
file and convert it to variables so you can use it in your program.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.