File "C:\Users\Administrator\Documents\Mibot\oops\blinkserv.py", line 82, in __init__
self.serv = socket(AF_INET,SOCK_STREAM)
TypeError: 'module' object is not callable
Why am I getting this error?
I'm confused.
What do you need to know to answer my question?
Best Solution
socketis a module, containing the classsocket.You need to do
socket.socket(...)orfrom socket import socket:This is what the error message means:
It says
module object is not callable, because your code is calling a module object. A module object is the type of thing you get when you import a module. What you were trying to do is to call a class object within the module object that happens to have the same name as the module that contains it.Here is a way to logically break down this sort of error:
module object is not callable. Python is telling me my code trying to call something that cannot be called. What is my code trying to call?"socket. That should be callable! Is the variablesocketis what I think it is?`print socket