fix raise for py3
fix "except" to be compatible with py3