提交 1e1fefca authored 作者: David Warde-Farley's avatar David Warde-Farley

Handle except (C1, C2, ...), e

find . -name '*.py' -exec sed -i '.bak' 's/^\( *\)except \((.*)\),/\1except \2 as/' {} \;
上级 074784d0
......@@ -660,7 +660,7 @@ try:
# skip VM.__init__
except ImportError:
pass
except (OSError, theano.gof.cmodule.MissingGXX), e:
except (OSError, theano.gof.cmodule.MissingGXX) as e:
# OSError happens when g++ is not installed. In that case, we
# already changed the default linker to something else then CVM.
# Currently this is the py linker.
......
......@@ -413,7 +413,7 @@ def use(device,
" crash when we try to use features"
" that your GPU does not support.")
except (EnvironmentError, ValueError, RuntimeError), e:
except (EnvironmentError, ValueError, RuntimeError) as e:
_logger.error(("ERROR: Not using GPU."
" Initialisation of device %s failed:\n%s"),
str(device), e)
......@@ -448,7 +448,7 @@ def use(device,
# in case the device if just gpu,
# we check that the driver init it correctly.
cuda_ndarray.cuda_ndarray.CudaNdarray.zeros((5, 5))
except (Exception, NameError), e:
except (Exception, NameError) as e:
# NameError when no gpu present as cuda_ndarray is not loaded.
e.args += ("ERROR: GPU forced but failed. ",)
raise
......
......@@ -289,7 +289,7 @@ def inplace_elemwise_optimizer_op(OP):
fgraph.validate()
chk = fgraph.checkpoint()
nb_change_no_validate = 0
except (ValueError, TypeError, InconsistencyError), e:
except (ValueError, TypeError, InconsistencyError) as e:
if check_each_change != 1 and not raised_warning:
print >> sys.stderr, (
"Some inplace optimization was not "
......@@ -3309,7 +3309,7 @@ if 0:
def tmp(thing):
try:
return T.get_scalar_constant_value(thing)
except (TypeError, ValueError), e:
except (TypeError, ValueError) as e:
print e, thing.owner.inputs[0]
return None
print 'LOCAL SUM EMPTY', [tmp(s) for s in y_shape]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论