From 47013c7948802488553ab177af55c08695be4f75 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 21 Dec 2013 20:11:20 +0100 Subject: [PATCH] Use sys.stdout.write instead of print in progress For some reason, this avoids having multiple "lines" on top of each other, which was always due to print()' newlines. And this makes the client/js part much more stable. --- morss.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/morss.py b/morss.py index 58e0a0f..2c8a41a 100644 --- a/morss.py +++ b/morss.py @@ -584,9 +584,9 @@ def Gather(url, cachePath, options): if options.progress: end = size if MAX_ITEM == -1 else min(MAX_ITEM, size) if options.json: - print json.dumps((i+1, end, item), default=lambda o: dict(o)) + sys.stdout.write(json.dumps((i+1, end, item), default=lambda o: dict(o)) + "\n") else: - print "%s/%s" % (i+1, end) + sys.stdout.write("%s/%s\n" % (i+1, end)) sys.stdout.flush() queue = Queue.Queue()