I am trying to send a file using flask:
@app.route('/genFIT', methods=["POST"])
def genFIT():
# CREATE MEMORY FILE create an output stream
output = BytesIO()
writer = pd.ExcelWriter(output, engine='xlsxwriter')
# some code to write in the 'file'
# save
writer.save()
# the writer has done its job
writer.close()
# go back to the beginning of the stream
output.seek(0)
return send_file(output, attachment_filename="my_file" + ".xlsx", as_attachment=True)
However is returning the error:
2019-07-13 10:25:45,022: [2019-07-13 10:25:45,021] ERROR in app: Exception on /genFIT [POST]
2019-07-13 10:25:45,023: io.UnsupportedOperation: fileno
I would appreciate any guidance to overcome this issue. This code works fine at my localhost. Txs