don't output empty import line if old style enums are used
diff --git a/compiler/cpp/src/thrift/generate/t_py_generator.cc b/compiler/cpp/src/thrift/generate/t_py_generator.cc
index f330b50..4457871 100644
--- a/compiler/cpp/src/thrift/generate/t_py_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_py_generator.cc
@@ -467,10 +467,10 @@
<< "from thrift.protocol.TProtocol import TProtocolException"
<< endl
<< "from thrift.TRecursive import fix_spec"
- << endl
- << (gen_enum_ ? "from enum import IntEnum" : "")
<< endl;
-
+ if (gen_enum_) {
+ ss << "from enum import IntEnum" << endl;
+ }
if (gen_utf8strings_) {
ss << endl << "import sys";
}