Python flask on downloading zip file gets corrupted
Python flask on downloading zip file gets corrupted I have written following python flask code to download zip file. @ns.route('/zip_file_download', strict_slashes=False) class ZipDownload(Resource): def get(self): output_path = os.path.abspath(os.path.join(os.getcwd(), './out')) out_file_name = os.path.join(output_path, 'sample.zip') r = send_file(out_file_name, mimetype='application/octet-stream', attachment_filename='sample.zip', as_attachment=True) return r This downloads the zip file but on extracting the zip file it gives an error - Error - 21 - is not a directory - Unable to expand probably because it gets corrupted. I also tried with send_from_directory but the same error crept there too. I am developing this on Mac machine but the downloaded files are also corrupted when opened on windows or an other OS. Any suggestions? PS: Moreover, this issue is only happening when running the API from a Mac machine. Things ...