13 Sep
2012
13 Sep
'12
8:52 p.m.
Terry Reedy writes:
try: try:
Ugh-ugh.<0.5 wink>
try: operation() except Exception as err: if isinstance(err, IOError) and err.errno == 2:
Ugh.<0.5 wink> Not your fault, but these constructions are pretty ugly IMO, I have to go with the OP on that. ISTR there were discussions of "qualified except" clauses here maybe 6mo to 1yr ago? That is, they'd look something like try: operation() except IOError as err if err.errno == 2: do_something() except Exception: logger.error("Error performing operation: {}".format(err.message)") some_clean_up() raise Again ISTR that this got spiked for some reason, but maybe it will be of use to the OP in formulating his next idea. Sorry for the lack of precise reference.