← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #275468]: read location from file for dragDrop

 

Question #275468 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/275468

    Status: Open => Answered

RaiMan proposed the following answer:
Location expects 2 parameters being numbers.
The given string in variable line from your point of view looks like that, but cannot be converted by Python.

so this is one option you have (IMHO the easiest one):

f = open("C\Test.txt")
for line in f.readlines():
    exec("dragDrop(Location(" + line.strip() + "),Location(200,200)")
f.close()

we build a code line, that is correct Python and tell the interpreter to execute it.
the strip() eliminates leading/trailing whitespace like newline character.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.