-
Notifications
You must be signed in to change notification settings - Fork 24
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
sys_pipes()
hangs on mac os
#84
Comments
Maybe I am mis-using this tooling: Line 537 in d7f3ed1
|
You're right - I think perhaps what you want is |
Hopefully #85 will give you a more meaningful error message that should point you in the right direction, rather than hanging uninformatively. |
Thanks for the reply @minrk . What I am trying to do is map stderr to stdout. When tensorflow starts up it writes to stderr. This shows up in my logging environment as an error. What i would like to do is redirect stderr to stdout so that these messages show up as info instead. EDIT - Logged a separate issue to discuss this issue in: #87 |
Strangely, it looks like updating from This code now works: import sys
from contextlib import redirect_stderr
from wurlitzer import sys_pipes
# Tensorflow prints messages to stderr when it is imported. These show up in
# GCP logging as errors. To avoid this we are redirecting stderr to stdout.
# See: https://github.com/tensorflow/tensorflow/issues/62770
# And: https://stackoverflow.com/questions/77796003/how-to-redirect-tensorflow-import-errors-from-stderr-to-stdout
with redirect_stderr(sys.stdout):
with sys_pipes():
import tensorflow # noqa: W0611 |
Yes, 3.1 optimizes forwarding to a file with a # redirect_stderr:
sys.stderr = sys.stdout
# sys_pipes:
forward sys.__stdout__ to sys.stdout # this hung in 3.0, not in 3.1; this is why I have `stdout=None` in my example, to skip this step
forward sys.__stderr__ to sys.stderr # which is actually sys.stdout thanks to redirect_stderr |
Running the following code causes
sys_pipes()
to hang on mac os.__init__.py
file:Output is:
Computer info:
Version info:
I cannot reproduce when running in docker.
The text was updated successfully, but these errors were encountered: