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


Groups > comp.lang.python > #90880

Re: Best way to rewrite Popen

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jonas@wielicki.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'true,': 0.05; 'filename:fname piece:signature': 0.16; 'i\xe2\x80\x99m': 0.16; 'overrule': 0.16; 'received:78.47': 0.16; 'stdout': 0.16; 'unexpected': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'shell': 0.22; 'this?': 0.23; 'header:User-Agent:1': 0.23; 'environment': 0.24; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'that.': 0.31; 'moment': 0.34; 'could': 0.34; 'there': 0.35; 'being': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'most': 0.60; 'issues,': 0.61; 'times': 0.62; 'subject:Best': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=wielicki.name; s=k001.sol; t=1432057405; bh=ndwSmfM2d4/WVjVrfqIERowNvu4M9ouIEzoFcnpx1nE=; h=Date:From:To:Subject:References:In-Reply-To; b=t/SmV5gxh9j5PvV94HfPoN7+MwQjmjzG0k9b0UXJq39jV9ChGyevzruuDIE9FZ9j6 RmAAr+rzsIMWgTZcyNzquyJATF3rVaK+NLnspUqEu2aXSBlDKZh8Cms2nojyZEOo1p U8w1HgjPlUmYI/RpbQMb7NLSegr/0BwExk+fNWO3QFqJqFf4HaZ+XiNgH50ZBHM0oC K75rqVgl7CCpVybRe/+DxIvnvYJcraIxwzZyLXiQVgvJYwo6l2yIDiCQxgUwHRsR+X /8Y3PovqpcFuW/KlnOoTcXOQ7sHGtxvD9dnFlkL+JfLUXbrg1IipnXqKXX3FvyE8ef Y1xyoTdOjQ5jg==
Date Tue, 19 May 2015 19:43:06 +0200
From Jonas Wielicki <jonas@wielicki.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Best way to rewrite Popen
References <87siastsby.fsf@Equus.decebal.nl>
In-Reply-To <87siastsby.fsf@Equus.decebal.nl>
Content-Type multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="I4aLt9CNFmaXkoE30bE7UlLfxQRQJGi3e"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.147.1432057412.17265.python-list@python.org> (permalink)
Lines 52
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432057412 news.xs4all.nl 2896 [2001:888:2000:d::a6]:55958
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:90880

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 19.05.2015 19:01, Cecil Westerhof wrote:
> At the moment I am playing with things like:
>     p = subprocess.Popen('ls -l', shell = True, stdout = subprocess.PIPE)
> 
> I think that most of the times this are the values I want. So it would
> be nice to overrule the defaults. What is the best way to do this? 

I would like to answer with a counter-question: Why do you want to do
this? What is the reason to use ls -l if you could also be using
os.listdir() or os.scandir()?

There are some reasons against screenscraping `ls` (locale-specifities
and environment variable dependencies of ls) and using shell=True (with
shells being huge complex beasts which may have unexpected security
issues, see Shellshock), so I’m not sure why you would want to do that.

regards,
jwi

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


Thread

Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 19:01 +0200
  Re: Best way to rewrite Popen Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 17:36 +0000
    Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 21:13 +0200
      Re: Best way to rewrite Popen Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 20:14 +0000
      Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 22:19 +0200
        Re: Best way to rewrite Popen Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 21:28 +0000
          Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 00:23 +0200
            Re: Best way to rewrite Popen MRAB <python@mrabarnett.plus.com> - 2015-05-20 00:20 +0100
              Re: Best way to rewrite Popen Cecil Westerhof <Cecil@decebal.nl> - 2015-05-20 02:15 +0200
  Re: Best way to rewrite Popen Jonas Wielicki <jonas@wielicki.name> - 2015-05-19 19:43 +0200
  Re: Best way to rewrite Popen Chris Angelico <rosuav@gmail.com> - 2015-05-20 03:47 +1000
  Re: Best way to rewrite Popen Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-05-19 12:55 -0500
  Re: Best way to rewrite Popen Chris Angelico <rosuav@gmail.com> - 2015-05-20 04:13 +1000
  Re: Best way to rewrite Popen Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-05-20 03:23 +0200

csiph-web