This is my tornado file::
from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop
from tornado.web import FallbackHandler, RequestHandler, Application
from flasky import app
class MainHandler(RequestHandler):
def get(self):
self.write("This message comes from Tornado ^_^")
tr = WSGIContainer(app)
application = Application([
(r"/tornado", MainHandler),
(r".*", FallbackHandler, dict(fallback=tr)),
])
if __name__ == "__main__":
application.listen(5000)
IOLoop.instance().start()
Basically I'm running a flask server in Tornado. But I'm getting this error:
from tornado.wsgi import WSGIContainer ImportError: No module named 'tornado'
I've already gone through this post: Python Tornado: WSGI module missing?
But my file is not named Tornado.py so that doesn't apply to me.
Please help.
I got rid of this by using following command.
sudo python3 -m pip install tornado
A common problem is having multiple Python interpreters, or multiple Python environments, installed. "pip" and "python" may use different environments. Try installing Tornado like this:
python -m pip install tornado
I faced the issue while testing tornado for the first time. It was because I named the file as tornado.py (as also mentioned by Mohamed Abdelijelil). I renamed it to tornado_test.py and it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With