[Tutor] error trap

kirk Bailey idiot1@netzero.net
Fri, 18 Jan 2002 14:46:27 -0500


Dan, nice idea, but what if an error comes up I did not anticipate? I
want it to send me ANY/ALL errors, so Iwant to write an exception with
a blanket definition. This only works for exceptions I manage to
anticipate. What about the rest?

Daniel Coughlin wrote:
> 
> On Fri, 18 Jan 2002, kirk Bailey wrote:
> 
> > OK, I am trying to handle it with a default except statement, and
> > capture the error feedback, but I get nothing but complaints when I
> > try THIS:
> >
> > for to_addr in members :                # for each address in
> > 'listnamemembers',
> >         # print "to_addr: ", to_addr
> >         # print "from_addr: ", from_addr
> >         # print "msg=" + CRLF, msg
> >         try:
> >                 server.sendmail(from_addr, to_addr, msg)        # 400
> > send envlope and msg!
> >         except e:
> 
> This line should be
> 
> except Exception, e:
> 
> or whatever specific exception you want:
> 
> except NameError, n:
> 
> then you can email yourself the value of n.
> 
> Hope this helps!
> 
> Daniel

-- 
 

 -Respectfully,
              -Kirk D Bailey 
               Consulting Loose Cannon

end



  www.howlermonkey.net                 highprimate@howlermonkey.net
  www.sacredelectron.org                         idiot1@netzero.net
  www.tinylist.org                              grumpy@tinylist.org
----------------------------------------------------
Sign Up for NetZero Platinum Today
Only $9.95 per month!
http://my.netzero.net/s/signup?r=platinum&refcd=PT97