On Sat, Jan 05, 2002 at 07:34:52AM -0800, Mark McEahern wrote: > Ladislav: > > Hello, > > My program sometimes raise the exception > > > > socket.error: (10061, 'Connection refused') > > > > How can I handle this kind of exception? > > try: > # your code that's failing > except: > # what you want to do when it fails
Or better: try: # your code that's failing except socket.error: # only catch that specific kind of error # what you want to do when it fails Though I am sure that that came up on python-tutor or python-list Cheers, Trent -- Trent Mick [EMAIL PROTECTED] _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/activepython