THRIFT-4370: build generated code before running static code analysis;
fix E722 flake8 issues identified in python code

This closes #1399
diff --git a/lib/py/setup.py b/lib/py/setup.py
index 3d14118..4056b9b 100644
--- a/lib/py/setup.py
+++ b/lib/py/setup.py
@@ -22,7 +22,7 @@
 import sys
 try:
     from setuptools import setup, Extension
-except:
+except Exception:
     from distutils.core import setup, Extension
 
 from distutils.command.build_ext import build_ext