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

This closes #1399
diff --git a/test/py/TestServer.py b/test/py/TestServer.py
index a7366a8..04ad62a 100755
--- a/test/py/TestServer.py
+++ b/test/py/TestServer.py
@@ -193,7 +193,7 @@
     try:
         pfactory.string_length_limit = options.string_limit
         pfactory.container_length_limit = options.container_limit
-    except:
+    except Exception:
         # Ignore errors for those protocols that does not support length limit
         pass
 
@@ -255,7 +255,7 @@
                     logging.info('Requesting server to stop()')
                 try:
                     server.stop()
-                except:
+                except Exception:
                     pass
             signal.signal(signal.SIGALRM, clean_shutdown)
             signal.alarm(4)