Re: Handling exceptions with Py2 and Py3

2016-05-27 Thread Ben Finney
Random832 writes: > On Fri, May 27, 2016, at 09:18, Ben Finney wrote: > > try: > > short_routine() > > except ConnectionRefusedError as exc: > > handle_connection_refused(exc) > > except OSError as exc: > > if exc.errno == errno.ECONNREFUSED: > > ha

Re: Handling exceptions with Py2 and Py3

2016-05-27 Thread Random832
On Fri, May 27, 2016, at 09:18, Ben Finney wrote: > try: > short_routine() > except ConnectionRefusedError as exc: > handle_connection_refused(exc) > except OSError as exc: > if exc.errno == errno.ECONNREFUSED: > handle_connection_refused(exc) But Co

Re: Handling exceptions with Py2 and Py3

2016-05-27 Thread Pavlos Parissis
On 27/05/2016 02:51 μμ, Steven D'Aprano wrote: > On Fri, 27 May 2016 10:24 pm, Pavlos Parissis wrote: > >> Hi, >> >> So, we have ConnectionRefusedError in Python3 but not in Python2. >> Six module doesn't provide a wrapper about this. >> >> What is most efficient way to handle this situation in a

Re: Handling exceptions with Py2 and Py3

2016-05-27 Thread Ben Finney
Pavlos Parissis writes: > So, we have ConnectionRefusedError in Python3 but not in Python2. > Six module doesn't provide a wrapper about this. There are many new exception types in Python 3 that inherit from OSError. They are designed to be more precise than disambiguuating the many reasons an O

Re: Handling exceptions with Py2 and Py3

2016-05-27 Thread Steven D'Aprano
On Fri, 27 May 2016 10:24 pm, Pavlos Parissis wrote: > Hi, > > So, we have ConnectionRefusedError in Python3 but not in Python2. > Six module doesn't provide a wrapper about this. > > What is most efficient way to handle this situation in a try-catch block? Um, could you give us a hint as to co

Handling exceptions with Py2 and Py3

2016-05-27 Thread Pavlos Parissis
Hi, So, we have ConnectionRefusedError in Python3 but not in Python2. Six module doesn't provide a wrapper about this. What is most efficient way to handle this situation in a try-catch block? Cheers, Pavlos signature.asc Description: OpenPGP digital signature -- https://mail.python.org/mail