py3: use 'as' for handling exceptions