简体   繁体   中英

Manage stdout and stdin in ipython notebook

A short ipython notebook cell:

%%bash    
read value
5
echo "Value: $value"

The output for this cell is Value: 5 Is possible to introduce the value interactively using the ipython notebook?

If now I try to run this:

%%bash
ssh user@host pwd

since is the first time trying to connect to host , ssh launches the question:

Are you sure you want to continue connecting (yes/no)?

But this question is printed in the shell where I started the ipython notebook, and not in the notebook itself. And here I can write the answer in the shell.

Would be possible to display the output and also introduce my answer through the notebook web interface?

This is a frustrating aspect of the notebook, but there's a (now merged) pull request to provide the ability to do interactive stdin within the notebook. To make use of this you'd have to install the master branch I believe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM