[IPython-user] Still trying to use pysh not-interactively

Ville M. Vainio vivainio@gmail....
Sun Mar 21 15:53:22 CDT 2010

On Sun, Mar 21, 2010 at 2:39 PM, Florian Lindner <mailinglists@xgm.de> wrote:
> Hello,
> I want to use the convenient features of the pysh mode (SLists, executing with !) in a non-interactive script. However I don't figure out how to do so...

It's somewhat messy.

A while bak, I got around the problem by making a new module for use
from scripts, see https://launchpad.net/sloppycode.

bzr branch lp:sloppycode

and check out test_slist.py. With it you can use something like:

    out = shcmd("ls -l /usr/bin")
    lscmds = out.fields(7).grep('^ls').n
    assert 'lsof' in lscmds

The module also covers various other "messy coding" goodies like
string interpolation used by ipython (Itpl) and chdir context manager.

Ville M. Vainio

More information about the IPython-user mailing list