Hi Community,
In my efforts, I ran across the following problem: When I use console.quicklook to preview my generated csv file, the 'open in' button does not function for any apps except for the iOS mail client.
Observations: All the icons appear, but when I touch them, it registers the touch and the menu goes away, but nothing happens (except for the mail client, which properly sends the generated csv as an attachment. The attachment can then be opened in the apps that were listed from safari, but this is a round about way).
The first two lines of the CSV file it is working off of are here:
20140121_data.csv
11-23-13 06:26:18 622.80
11-23-13 06:27:18 623.24
...
My code (forgive me for this, been working with python for a week :) ) is just attempting to find the time in seconds from the first event and create a new csv file that is formatted differently than the one listed above.
editCSV.py
csvfilename = time.strftime("%Y%m%d") + '_data.csv'
with open(csvfilename,'rbU') as csvfile:
reader = csv.reader(csvfile,delimiter='\t')
new_date_list = []
new_val_list = []
for row in reader:
#create new lists that will be turned into a csv later
new_date_list.append(row[0])
new_val_list.append(row[1])
update_del = [] #list for timedelta objects
for i in range(len(new_date_list)):
date_object = datetime.datetime.strptime(new_date_list[i], '%m-%d-%y %H:%M:%S')
#creates a timedelta object (difference between two date objects)
deltimeobj = date_object -
`` datetime.datetime.strptime(new_date_list[0], '%m-%d-%y %H:%M:%S')
update_del.append(deltimeobj.seconds)
#generates a new csv file
with open( time.strftime("%Y%m%d") + 'w'+ '_data.csv','wa') as csvfile:
writer = csv.writer(csvfile, dialect='excel')
for i in range(len(new_date_list)):
writer.writerow([str(update_del[i]),new_val_list[i]])
out_file_name = time.strftime("%Y%m%d") + 'w' + '_data.csv'
msg = ' Tap "send" icon at right of titlebar to "Open In" another app. '
console.hud_alert(msg, 'success', 3)
console.quicklook(out_file_name)
This code results in a csv file that can be opened only in the mail client, which I then email to myself, open in safari and then open in 'Graphical' by vernier (for example, many other apps open csv files.)
In this example, Graphical by Vernier (and every other app that supports csv files) shows up as an 'open in' option but when touched does not register any action.
Any thoughts would be appreciated :)