]> jfr.im git - z_archive/twitter.git/commitdiff
Fixing the printNicely function to avoid broken output on redirections/pipe
authorReventlov <redacted>
Fri, 15 Aug 2014 20:01:21 +0000 (22:01 +0200)
committerMike Verdone <redacted>
Sat, 30 Aug 2014 14:17:40 +0000 (16:17 +0200)
twitter/util.py

index 8ea5601621c760293dfb3ab824e8032de950cc69..8d3bd8acac7c4b165ad515e840cb49a90d367b83 100644 (file)
@@ -48,9 +48,9 @@ def smrt_input(globals_, locals_, ps1=">>> ", ps2="... "):
 def printNicely(string):
     if hasattr(sys.stdout, 'buffer'):
         sys.stdout.buffer.write(string.encode('utf8'))
+        print()
         sys.stdout.buffer.flush()
         sys.stdout.flush()
-        print()
     else:
         print(string.encode('utf8'))