Я пытаюсь изучить сопроводительные письма торнадо, но у меня ошибка при использовании кода ниже.
Traceback (most recent call last):
File "D:\projekty\tornado\env\lib\site-packages\tornado\web.py", line 1334, in _execute
result = yield result
File "D:\projekty\tornado\env\lib\site-packages\tornado\gen.py", line 628, in run
value = future.result()
File "D:\projekty\tornado\env\lib\site-packages\tornado\concurrent.py", line 109, in result
raise_exc_info(self._exc_info)
File "D:\projekty\tornado\env\lib\site-packages\tornado\gen.py", line 631, in run
yielded = self.gen.throw(*sys.exc_info())
File "index.py", line 20, in get
x = yield 'test'
File "D:\projekty\tornado\env\lib\site-packages\tornado\gen.py", line 628, in run
value = future.result()
File "D:\projekty\tornado\env\lib\site-packages\tornado\concurrent.py", line 111, in result
raise self._exception
BadYieldError: yielded unknown object 'test'
Код:
from tornado.ioloop import IOLoop
from tornado.web import RequestHandler, Application, url
from tornado import gen
class HelloHandler(RequestHandler):
@gen.coroutine
def get(self):
x = yield 'test'
self.render('hello.html')
def make_app():
return Application(
[url(r"/", HelloHandler)],
debug = True
)
def main():
app = make_app()
app.listen(8888)
IOLoop.instance().start()
main()