[Tutor] Checking for custom error codes

Alan Gauld alan.gauld at btinternet.com
Wed Aug 8 09:48:22 CEST 2007


"wormwood_3" <wormwood_3 at yahoo.com> wrote

>    def lookup(self):
> ...
>        for potdomain in self.potdomains:
>            try:
>                who.whois(potdomain)
>                self.availdomains.append(potdomain)
>            except 'NoSuchDomain':
>                pass

> This may, however, be something else wrong with my code, or the 
> rwhois module, not the try, except check.

You couldcheck that the except is working by replacing the pass
statement with a print statement. If the print statement shows
up you know the except worked so you can put the pass back in.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list