最近在使用bottle下载文件的时候出现异常,错误信息如下:

Critical error while processing request

但是异常仅仅出现在gunicorn部署的时候,python3 index.py却没有出错

而解决方案也很简单,用quote处理一下文件名,而不是把它编码成IOS-8859-1

file_name = quote(file_name)
response.set_header("Content-disposition", "attachment; filename=" + file_name)