Answer:
The error you are getting because:
“TypeError: 'module' object is not callable” occurs when the python compiler gets confused between function name and module name and try to run a module name as a function. In the above example, we have imported the module “os” and then try to run the same “os” module name as a function
What to do:
socket is a module, containing the class socket.
You need to do socket.socket(...) or
from socket import socket:
import socket
socket
<module 'socket' from 'C:\Python27\lib\socket.pyc'>
socket.socket
<class 'socket._socketobject'>
from socket import socket
socket
<class 'socket._socketobject'>
Hope you understand this if you still do not understand fell free to ask anything you want to know about this problem.
Happy coding.