Skip to content

WebAgg: flush stdout after printing, redirect "stopped" message to stder... [backport to 1.4.x] #3762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2014

Conversation

vmarkovtsev
Copy link
Contributor

...r

Without flushing, the message can be displayed too late. KeyboardInterrupt message should be printed to stderr.

try:
tornado.ioloop.IOLoop.instance().start()
except KeyboardInterrupt:
print("Server stopped")
six.print_("Server is stopped", file=sys.stderr)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are using from from future import print_function at the top so I don't think there is any need for using six here

@tacaswell tacaswell added this to the v1.4.3 milestone Nov 7, 2014
@tacaswell tacaswell changed the title WebAgg: flush stdout after printing, redirect "stopped" message to stder... WebAgg: flush stdout after printing, redirect "stopped" message to stder... [backport to 1.4.x] Nov 7, 2014
@tacaswell
Copy link
Member

What is the logic for printing the interupt message to stderr?

👍 on flush

👎 on stderr, on the basis of not changing things that can break user code without good reason.

Without flushing, the message can be displayed too late
@vmarkovtsev
Copy link
Contributor Author

The logic is that KeyboardInterrupt (as any other Exception) is written to stderr. Anyway, changed as requested.

tacaswell added a commit that referenced this pull request Nov 12, 2014
MNT : WebAgg: flush stdout after printing, redirect "stopped" message to stder
@tacaswell tacaswell merged commit 57fcef2 into matplotlib:master Nov 12, 2014
tacaswell added a commit that referenced this pull request Nov 12, 2014
MNT : WebAgg: flush stdout after printing, redirect "stopped" message to stder
@tacaswell
Copy link
Member

Thanks!

Cherry-picked as 8ca8a2c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants