When using ipython notebook, the output of child processes spawned by subprocess
never shows up in the notebook itself. For example, this cell
import subprocess
subprocess.check_call(['echo', 'hello'])
Only shows 0
as output, and the hello
is printed on the terminal where ipython is launched.
Is there any configuration parameters I can tune such that the output of child processes show up in the notebook itself?
Actually custom python c extensions will also have their output swallowed. Is there any fix?
Use check_output
if you want the output captured. check_call
returns the exit code.
import subprocess
print subprocess.check_output(['echo', 'hello'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With