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.
This commit is contained in:
4
morss.py
4
morss.py
@@ -584,9 +584,9 @@ def Gather(url, cachePath, options):
|
|||||||
if options.progress:
|
if options.progress:
|
||||||
end = size if MAX_ITEM == -1 else min(MAX_ITEM, size)
|
end = size if MAX_ITEM == -1 else min(MAX_ITEM, size)
|
||||||
if options.json:
|
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:
|
else:
|
||||||
print "%s/%s" % (i+1, end)
|
sys.stdout.write("%s/%s\n" % (i+1, end))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
queue = Queue.Queue()
|
queue = Queue.Queue()
|
||||||
|
Reference in New Issue
Block a user