use py3 exception capturing syntax