Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 29th, 2004, 04:32 PM
Dagan Dagan is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 1 Dagan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Whats wrong with this? need help..

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()

Reply With Quote
  #2  
Old May 29th, 2004, 05:28 PM
NetBSD NetBSD is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Canada
Posts: 234 NetBSD Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 9 h 25 m 35 sec
Reputation Power: 0
Send a message via MSN to NetBSD
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Whats wrong with this? need help..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway