[Tutor] exceptional behaviour

paul polb@cableinet.co.uk
Wed, 23 Jan 2002 08:48:57 -0000


Hello list,
	I've been looking at exceptions (using a gauld's fine book) with 
python2.1, but the examples wouldn't work until I removed the 
space from the raise string
eg
def div42():
	denominator=input("What value will I divide 42 by?\n")
	if denominator == 0:
		raise "firstproblem"
	elif denominator == 1:
		raise "secondproblem"
	else:
		print 42/denominator

works fine but

def div42():
	denominator=input("What value will I divide 42 by?\n")
	if denominator == 0:
		raise "first problem"
	elif denominator == 1:
		raise "second problem"
	else:
		print 42/denominator

doesn't

Is this a known bug or am I missing something? I can't see 
anything on Sourceforge and I would of thought this kind of error 
would jump out early, so I suspect the latter.

cheers

Paul Butler