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 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
The right name is SocketServer
in Python2 and socketserver
in Python3.
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
If you are using python 3 it is available as socketserver (all lowercase)