py3 compatible exception syntax

tests failed due to py3 incompatible exception syntax