← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #132445]: Reading / writing to a file in sikuli

 

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

Nicolas posted a new comment:
Hello RaiMan,

I noticed I cannot run this when combined with another function. The
file is not edited.

Example:

###########

my_dir = "c:\\"
el = "\n" # the end of line you want to use
my_file=file(my_dir + "data.txt", "w")
finalString = str("Initial string.")

def writeInFile():

    global finalString
    global my_file
    global my_dir
    global el

    my_file.write("finalString"+el) # if you want to have line breaks
    my_file.close

def generateFinalString():
    finalString = str("Modified string.")

generateFinalString()
writeInFile()

#########

Do I miss something?

Thanks for your help and for your awesome work on Sikuli!

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