[Tutor] Stupid newbie question
bill at celestial.net
Sat Sep 24 00:38:27 CEST 2005
On Fri, Sep 23, 2005, Valone, Toren W. wrote:
>I am trying to noodle thru classes with python and I built the following
> def __init__(self):
> remailfile = open('U:\Bounce20.txt', 'r') #future
>address/file from outlook
> resendfile = open('resend.txt', 'w') #currently these
>files are in Python24
> EmailReport = open('erprt.txt', 'w') #Report of bad
> fromaddr='Tvalone at dmv.ca.gov' #set fromadd to a
> null_recepient_count = 0
> date_received = ""
> date_email_generated = ""
> Error_050 = ""
> Error_501 = ""
> Current_Date = time.ctime(time.time())
> month = Current_Date[4:8]
> day = Current_Date[8:10]
> print month
> def getday(self):
> return self.day
> def Read(self,line):
> line = remailfile.readline() #primer read
> return line
>I fire up IDLE and then do this
>from startremail import *
>x = startremail()
>I get the following return
>NameError: name 'getday' is not defined
It appears that you're being bitten by my least-favorite ``feature''
of python, indentation errors. The getday routine appears to be a
subroutine of __init__, not a method of the class.
BTW: Not to start a religious war, I hated BEGIN/END blocks on
ALGOL too, but in those days my editor was an 026 keypunch or
worse, making paper tapes on a teletype for time sharing services.
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software LLC
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
``You know the one thing that's wrong with this country? Everyone gets a
chance to have their fair say.''
-Bill Clinton, May 29, 1993, The White House
More information about the Tutor