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
BUG: Can't run subprocess.Popen(..., stdout=sys.stdout) in IPython window #272
Comments
Yes, the stdout and err are not files in the ipykernel as they are hooked to ZMQ. |
Unfortunately that workaround does not allow code to be written to work in both |
You would need to use a pipe, pull data from it and write it to stdout yourself. This should work both in ipykernel and in a terminal. I wrote a little example of doing that here: It gets trickier if you need to get (If the program will run briefly and it's OK to show output when it's finished, it's even easier: from subprocess import run, PIPE
res = run(['who'], stdout=PIPE)
print(res.stdout.decode('utf-8')) ) |
Alternatively, Min's wurlitzer package might be able to help you. |
Okay, I'll see if I can work around the issue for now. Thanks for the tips |
This fails in Jupyter notebook but passes in plain
python
andipython
:With output:
The text was updated successfully, but these errors were encountered: