add python3 compatibility changing exception handling