[FRPythoneers] trapping exceptions

Erick Bodine erick at allocity.com
Wed May 21 11:08:47 MDT 2003


I would like to create a custom exception class that would wrap IOError
so that I can catch its message string and do some other things.  I made
a stab at it with the below code, trying several variations none of
which were successful.  How is this accomplished and is there a better

class MyException(IOError):
	def __init__(self):

def change_state(value):
	# change a value in a temp file

	f = open('nonexistent.txt')
except MyException, error:
	print "IOError message"


More information about the FRPythoneers mailing list