[IPython-User] catching system call's output in notebook
Mon Feb 6 13:15:06 CST 2012
On 02/06/2012 08:11 PM, Zoltán Vörös wrote:
> 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')
> 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?
use the subprocess module instead of os.system:
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 836 bytes
Desc: OpenPGP digital signature
Url : http://mail.scipy.org/pipermail/ipython-user/attachments/20120206/a3bd18c5/attachment.bin
More information about the IPython-User