No Module Named ServerSocket

Question:

I am trying to follow Example 20.17.4.1. SocketServer.TCPServer from Python Docs. But I get an error:

ImportError: No module named 'ServerSocket'

I am using new version of Python and use IDLE for editing and executing the script. Need help to get rid of this error.

Asked By: Romaan

||

Answers:

If you are using python 3 it is available as socketserver (all lowercase)

Answered By: Sushant Gupta

The right name is SocketServer in Python2 and socketserver in Python3.

Answered By: Stephan Dollberg

In the code I have It already tried importing SocketServer and socketserver but neither work.

try:
    import SocketServer as socketserver
    from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
except ImportError:
    import socketserver
    from http.server import HTTPServer, BaseHTTPRequestHandler

However after I can this command it worked for me

$pip install Werkzeug --upgrade 
Answered By: CodeMAster

I got the same problem, which was resolved by uninstalling and installing the Flask and Werkzeug again

1) pip uninstall Flask
2) pip uninstall Werkzeug

3) pip install Flask
4) pip install Werkzeug

Answered By: MUHAMMAD BILAL KHAN
  1. pip uninstall Flask 2) pip uninstall Werkzeug

  2. pip install Flask 4) pip install Werkzeug

Didn’t work for me. I end up reinstalling odoo 13 every single time. Although I’ve noticed that this occurs only when I add odoo/addons as a source map in pycharm.

Edit: I finally found the issue!
If you’re using pycharm and have odoo/addons added in your Content Root, try removing it from the content root and re-run the server. Hope it helps someone

Answered By: mat15
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.