When starting a simple application:

import tornado.web from tornadio import server from handler import BroadcastHandler urls = [ (r"/", BroadcastHandler) ] application = tornado.web.Application( urls ) if __name__ == "__main__": server.SocketServer(application) 

The following errors occur:

 Traceback (most recent call last): File "serv.py", line 2, in <module> from tornadio import server File "/usr/local/lib/python3.4/dist-packages/tornadio/__init__.py", line 15, in <module> from tornadio.router import get_router File "/usr/local/lib/python3.4/dist-packages/tornadio/router.py", line 16, in <module> from tornadio import persistent, polling, session File "/usr/local/lib/python3.4/dist-packages/tornadio/polling.py", line 17, in <module> from urllib import unquote ImportError: cannot import name 'unquote' 

On the Internet, they write that when such an error occurs, you can try to replace from urllib import unquote with from urllib.parse import unquote .

Help me to understand.

    1 answer 1

    The error is not in your application, but in the tornadio library. According to https://github.com/mrjoes/tornadio, the library has not been updated for 5 years, which may suggest that it is incompatible with Python3. This exception is due to incompatibility - in Py3, the urllib module has been reorganized. You can replace the line in polling.py 17 with from urllib.parse import unquote , but it will not work anyway, because this is not the only problem.

    And if you need Websockets, then in Tornado they are already implemented in the tornado.websocket module.