fixed syntax of an exception for python 3 compatibility