运行报错,页面无响应
`ERROR:tornado.application:Uncaught exception GET / (127.0.0.1) HTTPServerRequest(protocol='http', host='127.0.0.1:9000', method='GET', uri='/', version='HTTP/1.1', remote_ip='127.0.0.1') Traceback (most recent call last): File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) File "/www/wwwroot/ctf/view/index.py", line 8, in get self.render(nav='index') File "/www/wwwroot/ctf/view/init.py", line 149, in render self.finish(tmpl.render(**kwargs)) File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1154, in finish future = self.flush(include_footers=True) File "/www/wwwroot/ctf/view/init.py", line 174, in flush super(View, self).flush(include_footers, callback) TypeError: flush() takes from 1 to 2 positional arguments but 3 were given ERROR:tornado.application:Uncaught exception in write_error Traceback (most recent call last): File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) File "/www/wwwroot/ctf/view/index.py", line 8, in get self.render(nav='index') File "/www/wwwroot/ctf/view/init.py", line 149, in render self.finish(tmpl.render(**kwargs)) File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1154, in finish future = self.flush(include_footers=True) File "/www/wwwroot/ctf/view/init.py", line 174, in flush super(View, self).flush(include_footers, callback) TypeError: flush() takes from 1 to 2 positional arguments but 3 were given
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1214, in send_error self.write_error(status_code, **kwargs) File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1242, in write_error % {"code": status_code, "message": self._reason} File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1154, in finish future = self.flush(include_footers=True) File "/www/wwwroot/ctf/view/init.py", line 174, in flush super(View, self).flush(include_footers, callback) TypeError: flush() takes from 1 to 2 positional arguments but 3 were given ERROR:tornado.application:Exception in exception handler Traceback (most recent call last): File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) File "/www/wwwroot/ctf/view/index.py", line 8, in get self.render(nav='index') File "/www/wwwroot/ctf/view/init.py", line 149, in render self.finish(tmpl.render(**kwargs)) File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1154, in finish future = self.flush(include_footers=True) File "/www/wwwroot/ctf/view/init.py", line 174, in flush super(View, self).flush(include_footers, callback) TypeError: flush() takes from 1 to 2 positional arguments but 3 were given
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1704, in _execute self._handle_request_exception(e) File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1761, in _handle_request_exception self.send_error(500, exc_info=sys.exc_info()) File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1218, in send_error self.finish() File "/www/wwwroot/ctf/CTF_venv/lib/python3.7/site-packages/tornado/web.py", line 1154, in finish future = self.flush(include_footers=True) File "/www/wwwroot/ctf/view/init.py", line 174, in flush super(View, self).flush(include_footers, callback) TypeError: flush() takes from 1 to 2 positional arguments but 3 were given `
系统环境如下:python3.7,Centos7.5,
时代变了,tornado 6.0 移除了 callback 参数,你直接把那行
super(View, self).flush(include_footers, callback)
改成
super(View, self).flush(include_footers)
应该就行了 https://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.flush