Mark McEahern marklists at mceahern.com
Sat Feb 1 16:16:45 CET 2003

> I can't figure out how to do a custom error definition so the Try-Except
> thing would work. Could someone put it simply?

Subclass your exception from Exception; e.g.,

class MyException(Exception):pass

def dostuff():
    raise MyException

except MyException, e:
    print "We caught %s" % e

// m

More information about the Python-list mailing list