Re: Catching exceptions from Python 2.4 to 3.x

2012-11-17 Thread Steven D'Aprano
On Sat, 17 Nov 2012 14:26:43 +1100, Cameron Simpson wrote: On 17Nov2012 03:12, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: | Is there some other trick to grab the current exception from inside an | except block? sys.exc_info ? Thanks, that is just what I was looking for.

Catching exceptions from Python 2.4 to 3.x

2012-11-16 Thread Steven D'Aprano
Oh for the day I can drop support for Python 2.4 and 2.5... I have some code that needs to run in any version of Python from 2.4 onwards. Yes, it must be a single code base. I wish to catch an exception and bind the exception to a name. In Python 2.6 onwards, I can do: try: something()

Re: Catching exceptions from Python 2.4 to 3.x

2012-11-16 Thread Cameron Simpson
On 17Nov2012 03:12, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: | Oh for the day I can drop support for Python 2.4 and 2.5... | | | I have some code that needs to run in any version of Python from 2.4 | onwards. Yes, it must be a single code base. | | I wish to catch an