[IPython-User] catching system call's output in notebook

Zoltán Vörös zvoros@gmail....
Mon Feb 6 13:11:11 CST 2012


Hi All,

I have an embarrassing question, but I hope that this is an easy one and 
someone could just point out what I should do.

In short I would like to display the output of system calls in the html 
notebook. Let us say I have something called 'test', which will just 
print some time information.

Now, this one works in the notebook

In []: !./test
sec = 1328555007, usec = 990273
usec = 38350 sec = 0.038350
==========================================
sec = 1328555016, usec = 596183
usec = 8644260 sec = 8.644260
==========================================

but this one returns only a 0:

In []: os.system('./test')
0

I have checked this in the ipython console, and both work properly 
there, so it seems that there is something fishy in the notebook.
Of course, one could just use !./test all the time, but I don't want any 
code depend on ipython explicitly.
Any comments on this?
Cheers,
Zoltán





More information about the IPython-User mailing list