I need to send db data in csv format:
def send_csv():
    mkdir_p('csv')    
    outfile = open('csv/output.csv', 'w')
    outcsv = csv.writer(outfile)
    cursor = g.db.execute('Select * from my_table')
    outcsv.writerows(cursor)
    outfile.close()        
    return send_file('csv/output.csv', attachment_filename='output.csv')
But this gives following error during send_file:
RuntimeError: Attempted implicit sequence conversion but the response object is in direct passthrough mode.
 
     
    