← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #235236]: how to read each row of values declared in a function(with array of values) in another script

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
In the def you are assigning the new array to T, but T in this context
is only local: T in main remains unchanged.

... on the other hand: what you are doing is some kind of overkill:

# sub.sikuli
from sikuli import *
T = [["A4", "AO-001"],
       ["A4", "AO-002"]]

# main.sikuli
import sub
for n in range(len(sub.T)):
    testcase=sub.T[n]
    print testcase
    testfile=testcase[0]
    output=testcase[1]

When using a def in this case:

# sub.sikuli
from sikuli import *
T = [["A4", "AO-001"],
       ["A4", "AO-002"]]

def AO_array():
    return T

# main.sikuli
import sub
T = sub.AO_array()
for n in range(len(T)):
    testcase=T[n]
    print testcase
    testfile=testcase[0]
    output=testcase[1]

... but more noise.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.