From 7f14470f86435c96007655c40c89ffdc1706a2bf Mon Sep 17 00:00:00 2001 From: Vadim Markovtsev Date: Fri, 7 Nov 2014 16:31:42 +0300 Subject: [PATCH] WebAgg: flush stdout after printing Without flushing, the message can be displayed too late --- lib/matplotlib/backends/backend_webagg.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/backends/backend_webagg.py b/lib/matplotlib/backends/backend_webagg.py index 9c1a0e9a7f60..9583906ab2fe 100644 --- a/lib/matplotlib/backends/backend_webagg.py +++ b/lib/matplotlib/backends/backend_webagg.py @@ -21,6 +21,7 @@ import json import os import random +import sys import socket import threading @@ -333,11 +334,13 @@ def start(cls): launched. We may end up with two concurrently running loops in that unlucky case with all the expected consequences. """ - print("Press Ctrl+C to stop server") + print("Press Ctrl+C to stop WebAgg server") + sys.stdout.flush() try: tornado.ioloop.IOLoop.instance().start() except KeyboardInterrupt: - print("Server stopped") + print("Server is stopped") + sys.stdout.flush() finally: cls.started = False