fix raising exception syntax in python 3
Merge pull request #2735 from youngrok/develop

Fix raising exception syntax in Python 3. Fixes #2735, #2563.