[Tutor] Here is the whole script I'm having issues with.
S A
buc40@bemail.org
Thu, 22 Aug 2002 12:49:45 -0700
Ok. I was wrong. Actually, bbedit let me down. All the indentation looked correct when I loaded the file in bbedit. However, a quick chek with vi showed that the indentation was indeed off on the line story. I fixed it and now the classes load.
>
>> class Html:
>> def __init__(self, address):
>> self.address = address
>> #connection
>> def connect(self):
>> sock = urllib.urlopen("http://" + address)
>
>I'll assume the missing indentation is a fluke of your
>mailer or something....
>
>You are assigning to 'sock' but its local to the method.
>If you want sock to be available within the objkect you
>must assign to self.sock
Yes. I thought this might leave the class alittle more versatile for future use. With another script I make an instance;
x = Html("some address here")
Then I can just run:
x.connect() afterwards and the connect method runs. Actually, If I run an instance of the las method in the class, all of the methods in the class are run.
So if I add self to the method variables as you suggest and run:
x = Html("some address here")
Will the whole class run straight through?
This may be simpler than what I was doing.
Also, now that I have re-edited the script, would it be Ok to post for everyone to check out? Is anyone even interested in this script?
Thanks.
SA
"I can do everything on my Mac that I used to do on my PC, plus alot more ..."
-Me
------------------------------------------------------------
Free, BeOS-friendly email accounts: http://BeMail.org/
BeOS News and Community: http://www.BeGroovy.com/
---------------------------------------------------------------------
Express yourself with a super cool email address from BigMailBox.com.
Hundreds of choices. It's free!
http://www.bigmailbox.com
---------------------------------------------------------------------