Closed trevorbayless closed 1 year ago
patch_stdout
only patches sys.stdout/stderr
within the Python process. It has no control over a subprocess like a web browser. (It has not much to do with the app running in full screen). I'm not sure how to do it for the webbrowser module, but it needs to spawn a subprocess for which the stdout/stderr are not attached to the current PTY, but instead maybe /dev/null.
Thanks for the information. And in the case of a possible uncaught exception (which also tears the output) would the only possibility be redirecting stderr elsewhere (like a log file) right after starting the fullscreen application to avoid the tearing?
Is there a common approach to handling stderr output while a fullscreen application is running? I've attached some test code which uses the
webbrowser
to open the default web browser on click, enter, or F1. The webbrowser module spits out a few errors to stderr which ends up tearing the fullscreen application.I know on prompt applications, there's a
patch_stderr
method to tie things in nicely, but is there anything for fullscreen applications? Is the approach to redirect stderr elsewhere?This same issue can be seen if you happen to not catch a raised exception.
Before browser open:
After browser open:
Note The above errors are not uncaught exceptions, but stderr output from the
webbrowser
module. There is currently not a way to suppress these messages.Example code