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.
Answers:
If you are using python 3 it is available as socketserver (all lowercase)
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
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
-
pip uninstall Flask 2) pip uninstall Werkzeug
-
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
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.
If you are using python 3 it is available as socketserver (all lowercase)
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
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
pip uninstall Flask 2) pip uninstall Werkzeug
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