Hi all,

I am new to Python programming and this list, looks like a great place so far!

Recently I was trying to do a "try: X except Y: Z" statement, checking for a 
custom error code that the rwhois.py module throws. Some details on the 
exercise and the full code can be found on this post ( 
http://assistedsilicon.blogspot.com/2007/08/fun-with-python-domainspotter.html 
). So, here is what I tried:

        for potdomain in self.potdomains:
            try: 
                who.whois(potdomain)
                self.availdomains.append(potdomain)
            except 'NoSuchDomain':
                pass
            self.totalchecked+=1
If you need more context, the whole program is here ( 
http://assistedsilicon.blogspot.com/2007/08/fun-with-python-domainspotter.html#code
 ). I first tried simply "except NoSuchDomain", since that was what I saw 
rwhois throw when I sent it a domain that was not registered. That did not 
work, so I quoted it. I got a warning that throwing a string exception is 
deprecated, but the check did not work anyway. Am I trying to check for this 
custom error wrongly? How should it be done?

Thanks for any assistance!

-Sam


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to