Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10818

Re: Snippet: The leanest Popen wrapper

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.013
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'object.': 0.09; 'wed,': 0.12; 'am,': 0.13; 'defined': 0.14; 'wrote:': 0.15; '4096': 0.16; 'cc:addr:python-list': 0.16; 'this:': 0.16; 'def': 0.16; 'aug': 0.19; 'true,': 0.19; 'command': 0.19; 'cheers,': 0.19; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'code': 0.24; 'received:209.85.220': 0.25; 'yourself.': 0.28; 'message-id:@mail.gmail.com': 0.28; 'shell': 0.29; 'cc:addr:python.org': 0.30; 'chris': 0.32; 'anyone': 0.33; 'doing': 0.37; 'could': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'think': 0.38; 'either': 0.39; 'received:209': 0.40; 'subject:The': 0.73; 'escaping': 0.84; 'sender:addr:chris': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=TSHNO0itwhM9YgbtLy3Ssi0L7g33qqczYrP0FVLNpG8=; b=RbKFysgxwvJ6f54wXqUZdPw8KRiBr9HZTiKSTQB9UCmQG/xvNi9SPS0DohYN5seZOz RyWgvjfclYMYuQ2y6AWhqWBC/KsAoF1GMo0wRAZ4hpNY2US7CeBoroyZRcLdADjlFomf 1K3wzDDOfizitfbyPXu213udZRINxrelNIsoU=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <51b2d157-3fea-4f8e-80b4-e7142629eca8@s21g2000pre.googlegroups.com>
References <51b2d157-3fea-4f8e-80b4-e7142629eca8@s21g2000pre.googlegroups.com>
Date Wed, 3 Aug 2011 10:27:41 -0700
X-Google-Sender-Auth VFOs0mySD-PwuWiXvhmdEgmAHJg
Subject Re: Snippet: The leanest Popen wrapper
From Chris Rebert <clp2@rebertia.com>
To Phlip <phlip2005@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1856.1312392464.1164.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1312392464 news.xs4all.nl 23951 [2001:888:2000:d::a6]:58823
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10818

Show key headers only | View raw


On Wed, Aug 3, 2011 at 8:29 AM, Phlip <phlip2005@gmail.com> wrote:
> Groupies:
>
> This is either a code snippet, if you like it, or a request for a
> critique, if you don't.
>
> I want to call a command and then treat the communication with that
> command as an object. And I want to do it as application-specifically
> as possible. Anyone could think of a way to productize this:
>
> def command(*cmdz):
>
>    process = Popen( flatten(cmdz),

flatten() being defined as...?

>                     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.

>                     stdout= subprocess.PIPE,
>                     stderr= subprocess.PIPE,
>                     bufsize= 4096 )

Cheers,
Chris

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Snippet: The leanest Popen wrapper Phlip <phlip2005@gmail.com> - 2011-08-03 08:29 -0700
  Re: Snippet: The leanest Popen wrapper Peter Otten <__peter__@web.de> - 2011-08-03 18:21 +0200
  Re: Snippet: The leanest Popen wrapper Thomas Jollans <t@jollybox.de> - 2011-08-03 18:39 +0200
  Re: Snippet: The leanest Popen wrapper Chris Rebert <clp2@rebertia.com> - 2011-08-03 10:27 -0700
    Re: Snippet: The leanest Popen wrapper Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-08-04 10:10 +0200
      Re: Snippet: The leanest Popen wrapper Chris Rebert <clp2@rebertia.com> - 2011-08-04 01:42 -0700
        Re: Snippet: The leanest Popen wrapper Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-08-04 11:25 +0200
  Re: Snippet: The leanest Popen wrapper Phlip <phlip2005@gmail.com> - 2011-08-03 11:04 -0700
  Re: Snippet: The leanest Popen wrapper Terry Reedy <tjreedy@udel.edu> - 2011-08-03 16:20 -0400
  Re: Snippet: The leanest Popen wrapper Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-08-04 10:24 +0200
  Re: Snippet: The leanest Popen wrapper Yves-Gwenael Bourhis <ybourhis@distroiwork4.com> - 2011-08-04 15:19 +0200

csiph-web