[IPython-User] Controlling iPython output when starting notebook

Spencer Ogden spencer@spencerogden....
Wed Aug 29 10:49:56 CDT 2012


Ihave multiple users with logins on a shared Linux server. I would like 
to make using iPython as easy as possible by starting up a notebook as 
soon as they log in. This part is fine, what I would like to do is have 
less output from iPython, just a simple line saying "Go to: 
http://server:port" (there's no gui, so auto starting a browser doesn't 
make sense).

I am trying to capture the STDERR output of iPython, and grep that for 
the port number, but I'm not having much success. Any help is 
appreciated. Also, I may be approaching this problem in completely the 
wrong way.

The following lines work when I execute them sequentially in bash, but 
not when I source the .bash_profile. The server starts, but $port is not 
assigned. The sleep is there to give ipython time to print to the file.

ipython notebook --profile=personal &> 
~/.ipython/profile_personal/log/personal_session.log &

port=$(grep -o "[0-9]*" 
~/.ipython/profile_personal/log/personal_session.log)
sleep 5
echo $port
echo "Go to http://portcon:$port"



Spencer


More information about the IPython-User mailing list