Added flush when printing to standard output.
authortkragelj
Wed, 16 Dec 2009 14:12:47 +0100
changeset 526 68375ccdf968
parent 522 6bd373f930f2
child 527 2a3ab252b4e0
Added flush when printing to standard output.
LPCBeremiz.py
--- a/LPCBeremiz.py	Tue Dec 15 20:51:51 2009 +0100
+++ b/LPCBeremiz.py	Wed Dec 16 14:12:47 2009 +0100
@@ -804,6 +804,7 @@
         self.KillLocalRuntime()
         
         print "Closed"
+        sys.stdout.flush()
         
         event.Skip()
 
@@ -1301,6 +1302,7 @@
             args_toks = line.split('"')
             if len(args_toks) % 2 == 0:
                 print "Error: Invalid command"
+                sys.stdout.flush()
                 return
             args = []
             for num, arg in enumerate(args_toks):
@@ -1327,16 +1329,19 @@
                     print "Error: 1 argument%s expected" % extra
                 else:
                     print "Error: %d arguments%s expected" % (number, extra)
+                sys.stdout.flush()
                 return
             for num, arg in enumerate(args):
                 try:
                     args[num] = arg_types[num](arg)
                 except:
                     print "Error: Invalid value for argument %d" % (num + 1)
+                    sys.stdout.flush()
                     return
             res = getattr(self, function)(*args)
             if isinstance(res, (StringType, UnicodeType)):
                 print res
+                sys.stdout.flush()
                 return False
             else:
                 return res