Re: HTMLParser error

2008-05-24 Thread jjbutler88
On May 22, 8:20 pm, alex23 <[EMAIL PROTECTED]> wrote:
> On May 23, 5:06 am, [EMAIL PROTECTED] wrote:
>
> > Nope, this is my first experience with object oriented programming,
> > only been learning python for a few weeks but it seemed simple enough
> > to inspire me to be a bit ambitious. If you could hook me up with some
> > good docs that would be great. I was about to but a book on python,
> > specifically OO based, but il look at these docs first. I understand
> > most of the concepts of inheritance, just not ever used them before.
>
> Ah, okay, I'm really sorry, if I'd known I would've tried to explain
> things a little differently :)
>
> Mark Pilgrim's Dive Into Python is a really good place to 
> start:http://www.diveintopython.org/toc/index.html
>
> For a quick overview of object oriented programming in Python, 
> try:http://www.freenetpages.co.uk/hp/alan.gauld/
> Specifically:http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm
>
> But don't hesitate to ask questions here or even contact me privately
> if you'd prefer.


Thanks for the help, sorry for the delayed reply, flew out to detroit
yesterday and the wifi here is rubbish. Will definitely get reading
Dive into Python, and the other article cleared a lot up for me.
Hopefully I wont have these errors any more, if I keep getting them il
get in touch.

Cheers
--
http://mail.python.org/mailman/listinfo/python-list


Socket problems

2008-07-13 Thread jjbutler88
I am trying to write a simple python IRC client, roughly following
this guide: http://www.devshed.com/c/a/Python/Python-and-IRC/

I have written some code, which uses the same commands as the guide,
but I get this error:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/threading.py", line 486, in __bootstrap_inner
self.run()
  File "pythonirc.py", line 31, in run
self.sock.send('NICK %s\r\n') % self.nick
AttributeError: send

Here is my code so far:
[code]
#!/usr/bin/env python

from socket import *
from threading import Thread
import sys

class IRCBot(Thread):
def __init__(self, host, room, nick, port=6667, ssl=0):
Thread.__init__(self)
self.host = host
self.port = port
self.ssl = ssl
self.room = room
self.nick = nick
self.sock = socket(AF_INET, SOCK_STREAM)

def run(self):
print "Connecting..."
try:
self.sock.connect((self.host, self.port))
except:
print "Could not connect to %s" % self.host
sys.exit(1)
if self.ssl:
try:
self.sock = ssl(self.sock)
except:
print "Server does not suport SSL"
sys.exit(1)

self.sock.send('NICK %s\r\n') % self.nick
self.sock.send('USER PyIRC PyIRC PyIRC :Python IRC\r\n')
self.sock.send('JOIN #%s\r\n') % self.room
while True:
data = self.sock.recv(4096)
if data.find('PING') != -1:
self.sock.send('PONG' + data.split()[1]+'\r\n')
print data

def close(self):
self.sock.send('PART #%s\r\n') % self.room
self.sock.send('QUIT\r\n')
self.sock.shutdown(SHIT_RDWR)
self.sock.close()

IRCBot('irc.psych0tik.net','hbh', 'pythonircclient',6697,1).start()
[/code]

Anyone know why it might be doing this? Config problem?

Thanks in advance,
Jon

--
http://mail.python.org/mailman/listinfo/python-list