← Back to team overview

sikuli-driver team mailing list archive

[Question #242206]: write os.system generated message to csv-file

 

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

I like to add a row to an existing csv-file. The row should contain a timestamp (t1), text information and a numeric value (t2).  t1 is right now always zero, so my first question is how to get the message "2014-01-14 18:42:07" into t1 or into the csv-row itself? 

t1=os.system("echo $(date +'%Y-%m-%d %H:%M:%S')")                         
t2=567

with open('eggs.csv', 'wb') as csvfile:
    spamwriter = csv.writer(csvfile, delimiter=',',
                            quotechar='|', quoting=csv.QUOTE_MINIMAL)
    spamwriter.writerow([t1, 'grp_cci','Baked Beans', t2])

Second question: this script is always creating a new csv-file "eggs-csv" with only one row. But I need to add this row to an existing file. What do i have to change?

Peter

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