← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #264354]: how to read one complete row in the CSV

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
having unique, speaking names for different variable is vital.
Not obeying this rule leads to problems hard to debug.

In this case the same name Row is used for the row number and the row
content.

   for i in range(Row+1) :
        Row = data.next()

after the first loop, Row contains the first row's content and simply
terminates the loop.

So sort out your variables.

other problems in your script:

Row = int(input("Enter a row number"))
# this crashes, if no number is entered - usually wrapped with try:except:

if(Row == ""): # can never be, since Row now contains a number
    popup("no row number given")
    exit(0)

... and the next

def extractColInfo(temp):
    for i in range(7):
        tt[i] = temp[i]
        popup (str(tt[i]))

tt is not defined an hence cannot be used with a list index

def extractColInfo(temp):
    tt = [] # empty list
    for i in range(7):
        tt.append(temp[i]) # add to the end of the list
        popup (str(tt[i])) # now the index i is valid

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