python - Error serving large files when using Flask and Tornado -
i serving large static files ~70 mb, able download files when working in flask alone, getting error below when using tornado , flask.
exception ignored in: <bound method future.__del__ of <tornado.concurrent.future object @ 0x32c61acc>> traceback (most recent call last): file "/home/user/virtual/lib/python3.4/site-packages/tornado/concurrent.py", line 333, in __del__ file "/usr/local/lib/python3.4/traceback.py", line 181, in format_exception file "/usr/local/lib/python3.4/traceback.py", line 153, in _format_exception_iter file "/usr/local/lib/python3.4/traceback.py", line 18, in _format_list_iter file "/usr/local/lib/python3.4/traceback.py", line 65, in _extract_tb_or_stack_iter file "/usr/local/lib/python3.4/linecache.py", line 15, in getline file "/usr/local/lib/python3.4/linecache.py", line 41, in getlines file "/usr/local/lib/python3.4/linecache.py", line 126, in updatecache file "/usr/local/lib/python3.4/tokenize.py", line 437, in open attributeerror: 'module' object has no attribute 'open' here code using serve files
def download(path): def generate(): open(path, 'rb') file_handler: while true: chunk = file_handler.read(1024) if not chunk: break yield chunk return response(generate(), direct_passthrough=true, mimetype='application/octet-stream', headers={'content-disposition': 'attachment;filename={}'.format(os.path.basename(path))}) http_server = httpserver(wsgicontainer(app)) http_server.listen(port, address='0.0.0.0') ioloop.instance().start()
Comments
Post a Comment