Reputation: 7337
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.
Upvotes: 13
Views: 61539
Reputation: 63
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.
Upvotes: 5
Reputation: 79
I got rid of this by using following command.
sudo python3 -m pip install tornado
Upvotes: 7
Reputation: 24009
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
Upvotes: 16
Reputation: 149
check if tornado module is installed with pip and if you are using a virtualenv check if it's activated
Upvotes: 0