|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello!
I'm trying to make a little code who connects to IRC. whats wrong? and what am I missing? Thanks! Dagan Code:
'''
trying to make a IRC client,
getting "type error: 'module' object is not callable" in
line 16:
sock = socket(socket.AF_INET, socket.SOCK_STREAM)
'''
import socket
port = 6667
server = "eu.undernet.org"
channel = "#TestChan"
class IRCClass:
def __init__(self):
sock = socket(socket.AF_INET, socket.SOCK_STREAM)
self.bind((port, server))
def connect(self):
sock.connect()
try:
self.recieve()
except:
return "Something failed."
def recieve(self):
line = self.sock.recv(byte)
return line
irc = IRCClass()
irc.connect(port, server)
irc.byte = 1024
irc.recv()
|
|
#2
|
|||
|
|||
|
You need to use
Code:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) instead. What you are doing now is trying to call the module, not the "socket" function. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Whats wrong with this? need help.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|