Py3k: fixing exception type + flake8 PY3 detection