← Back to team overview

sikuli-driver team mailing list archive

[Question #645294]: error in reading Text file

 

New question #645294 on Sikuli:
https://answers.launchpad.net/sikuli/+question/645294

I am little new to sikuli and python, I am read a text file (text2.txt) 
my programming decision depend on first line of this text file
if first line is "Done" then this file is wrong.
if first line is other than "Done" so program call some function and run it

but problem is that when this text line contain only one line "Done" then it  work  and exit program after popup,
if by mistake there is one more line in text file(first line is "Done") program can not exit
 I really appreciate for help.

(sorry if any mistake in Description , If you don't get I can brief here once again)  


Here is my code

##############################################################################

f = open("c:/tool/Text2.txt", "r")
sumlist = []
for line in f.readlines():
    sumlist.append(str(line))
   
    print (line)
f.close()  
kk = sumlist[0]
kk = str(kk)
popup(kk)
if kk == "Done":
    popup("Wrong Database is created Fill all required cell in Excel and run tool again", "DataBase" )
    exit(1)
else:
#call some function


#############################################################################

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