I am trying to create a tempfile, write to it, then download it from my flask application.. however, i am receiving a FileNotFoundError when finishing the function. Here is my code & the error received. Thanks in advance.
with tempfile.TemporaryFile (mode='w', newline="", dir=".", suffix='.csv') as csvfilenew:
writer = csv.writer(csvfilenew, delimiter= ';')
myClick()
return send_file(str(csvfilenew.name), as_attachment=True, attachment_filename='cleanfile.csv')
FileNotFoundError: [Errno 2] No such file or directory: '/Desktop/bulk_final/10'
See Question&Answers more detail:os