Re: Handlign exceptions - NEWBIE !!

Jack Jansen (Jack.Jansen@cwi.nl)
Mon, 14 Mar 1994 11:31:13 +0100

Adrian,
the short answer:
remove the quotes around 'socket.error'.
The long answer:
Python exceptions are slightly strange in that the exception is
identified with the *identity* of the string passed to raise. I.e. it
is not the value of the string that counts but the string itself.

I.e. the following will not work as expected

error='MyError'
try:
....
raise error
except 'MyError':
....
The string in the raise and except should be the same instance.

--
Jack Jansen        | If I can't dance I don't want to be part of
Jack.Jansen@cwi.nl | your revolution             -- Emma Goldman
uunet!cwi.nl!jack    G=Jack;S=Jansen;O=cwi;PRMD=surf;ADMD=400net;C=nl