[Tutor] exception problems in socket programming
Vinay Reddy
vinayvinay at gmail.com
Thu Nov 16 20:20:38 CET 2006
> in other words you are tuple-unpacking the exception. Since it is not a
> tuple, but a single value, you get an error. Try this:
> except socket.error, e:
> if self.s:
> self.s.close()
> print "Could not open socket: " + e.message
Thanks a lot! I had to make a minor change to get it to work though.
'e' is a list with variable number of elements (depends on the
exception). Replacing e.message with str(e) does the trick.
Thanks,
Vinay
More information about the Tutor
mailing list