Clean up exception handling in TestON core

    - Catch more specific exceptions
    - Clearer Style
    - Allow CTRL-C to exit the test cleanly whether from the TestON
      cli or ruinning as a script

Change-Id: I7f2e8eeba5229f97c87e06b49a585933a61fa4ad
diff --git a/TestON/core/utilities.py b/TestON/core/utilities.py
index 02ade72..8cd81e5 100644
--- a/TestON/core/utilities.py
+++ b/TestON/core/utilities.py
@@ -121,8 +121,9 @@
         try :
             opcode = operators[str(arguments["OPERATOR"])][valuetype] if arguments["OPERATOR"] == 'equals' else operators[str(arguments["OPERATOR"])]
 
-        except KeyError:
+        except KeyError as e:
             print "Key Error in assertion"
+            print e
             return main.FALSE
 
         if opcode == '=~':
@@ -179,8 +180,9 @@
         if not isinstance(msg,str):
             try:
                 eval(str(msg))
-            except SyntaxError:
-                print "functin definition is not write"
+            except SyntaxError as e:
+                print "function definition is not right"
+                print e
 
         main.last_result = result
         return result
@@ -191,7 +193,6 @@
         '''
         newArgs = {}
         for key,value in kwargs.iteritems():
-            #currentKey =  str.upper(key)
             if isinstance(args,list) and str.upper(key) in args:
                 for each in args:
                     if each==str.upper(key):
@@ -199,8 +200,6 @@
                     elif each != str.upper(key) and (newArgs.has_key(str(each)) == False ):
                         newArgs[str(each)] = None
 
-
-
         return newArgs
 
     def send_mail(self):
@@ -211,7 +210,7 @@
                 sub = "Result summary of \""+main.TEST+"\" run on component \""+main.test_target+"\" Version \""+vars(main)[main.test_target].get_version()+"\": "+str(main.TOTAL_TC_SUCCESS)+"% Passed"
             else :
                 sub = "Result summary of \""+main.TEST+"\": "+str(main.TOTAL_TC_SUCCESS)+"% Passed"
-        except KeyError,AttributeError:
+        except ( KeyError, AttributeError ):
             sub = "Result summary of \""+main.TEST+"\": "+str(main.TOTAL_TC_SUCCESS)+"% Passed"
 
         msg['Subject'] = sub
@@ -250,7 +249,7 @@
             try :
                 parsedInfo = ConfigObj(self.fileName)
                 return parsedInfo
-            except Exception:
+            except StandardError:
                 print "There is no such file to parse "+fileName
         else:
             return 0