Memory Error occurs when downloading a file from Flask. The size of the file is about 100 megabytes. How can I fix it?
Flask Download Code
return send_from_directory(s_trash_path, s_zip_name, mimetype='zip', as_attachment=True)
Error Code
[2018-07-21 16:11:22,328] ERROR in app: Exception on /ec-fileupload/download/select [POST]
Traceback (most recent call last):
File "/home/venv_ec_fileupload/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/home/venv_ec_fileupload/lib/python3.6/site-packages/flask/app.py", line 1615, in full_dispatch_request
return self.finalize_request(rv)
File "/home/venv_ec_fileupload/lib/python3.6/site-packages/flask/app.py", line 1632, in finalize_request
response = self.process_response(response)
File "/home/venv_ec_fileupload/lib/python3.6/site-packages/flask/app.py", line 1856, in process_response
response = handler(response)
File "./app/__init__.py", line 170, in after_request
s_data = resp.get_data()
File "/home/venv_ec_fileupload/lib/python3.6/site-packages/werkzeug/wrappers.py", line 987, in get_data
rv = b''.join(self.iter_encoded())
MemoryError