Snippet: The leanest Popen wrapper

Phlip phlip2005 at gmail.com
Wed Aug 3 20:04:53 CEST 2011


> flatten() being defined as...?

Python Cookbook recipe 4.6

def flatten(sequence):  #  CONSIDER:  Reconcile with utils...
    for item in sequence:
        if isinstance(item, (list, tuple)):
            for subitem in flatten(list(item)):
                yield subitem
        else:
            yield item

>>                     shell= True,

> I would strongly encourage you to avoid shell=True. You really don't
> want to have to worry about doing proper shell escaping yourself.

Tx for helping me avoid reading up on it. I just copied it in.

I keep getting "fab not found" etc. when running 'fab command' thru
it. So then I ditch to os.system().

The long-term solution would be 'bash', '-c', 'yack yack yack' if you
want truly shelly things!

-- 
  Phlip
  http://c2.com/cgi/wiki?ZeekLand



More information about the Python-list mailing list