Re: Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
Reasons why it still won't work: * Firewall * Unknown-modes-operating-systems-get-into Yeah, I dont think these things can be avoided. Nonetheless, if I can come up with some way (via help from this group--thank God!) to find if the node is up (barring the two aforementioned reasons), I am doing

Re: Catching very specific exceptions

2006-01-22 Thread Roy Smith
"Harlin Seritt" <[EMAIL PROTECTED]> wrote: > I am finding that with the many quirks (and really bad foundation for > Win32 APIs) that I am having to write a lot of voodoo code so to speak. Yeah, tell me about it. My current project at work is porting our IPv6 management package (including ICMP p

Re: Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
Thanks for the effort on this last post, Roy. You asked what I was hoping to do differently on these two very minutely different error messages. What I have been trying to do for some time is to write a ping client (for Win32 platform -- Yes, I develop almost exclusively for Win32 environment, unfo

Re: Catching very specific exceptions

2006-01-22 Thread Roy Smith
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: > Harlin Seritt <[EMAIL PROTECTED]> wrote: > > > except socket.error: > > code goes here... > > > > Of course, though, these are two separate error messages under the same > > error handler though. I've tried: > > > >

Re: Catching very specific exceptions

2006-01-22 Thread Peter Hansen
Alex Martelli wrote: > what I've done in such situations is > > except socket.error, e: > if e.errno == 10061: > ... > elif e.errno == 10060: > ... > else: > raise > > Not sure the code in a socket.error has attributename 'errno', but I > hope you get the general idea. If it

Re: Catching very specific exceptions

2006-01-22 Thread Alex Martelli
Harlin Seritt <[EMAIL PROTECTED]> wrote: > except socket.error: > code goes here... > > Of course, though, these are two separate error messages under the same > error handler though. I've tried: > > except socket.error, (10061, 'Connection refused'): > and > except (socket.error, 10061, 'Co

Catching very specific exceptions

2006-01-22 Thread Harlin Seritt
I am running the following code: import socket host = '9.9.45.103' port = 10001 conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM) conn.connect((host, port)) When conn.connect() is run, there can be two different exceptions: socket.error: (10061, 'Connection refused') socket.error: (1006