catching exception in python2, added data for python3