Catch errors for python 2