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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --I4aLt9CNFmaXkoE30bE7UlLfxQRQJGi3e Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 19.05.2015 19:01, Cecil Westerhof wrote: > At the moment I am playing with things like: > p =3D subprocess.Popen('ls -l', shell =3D True, stdout =3D subproce= ss.PIPE) >=20 > 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?=20 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=3DTrue (with= shells being huge complex beasts which may have unexpected security issues, see Shellshock), so I=E2=80=99m not sure why you would want to do= that. regards, jwi --I4aLt9CNFmaXkoE30bE7UlLfxQRQJGi3e Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCgAGBQJVW3Y6AAoJEMBiAyWXYliKA60P/jZKg4dJqcFMg7F66gCJe58U kCh0CrJxvwxb0AvCURUkywE4uTA+oOBdgIAxqTWn4ioFFMsCmfkgK+VCIX6+JY7P XEVYjKmT7qzKYtbrDxhqQTPinvQaVuWFpmLS+SvpPGkjHv7sIuy/asZLa2T0PI7F WZR6/Exzyzu0fNvG5J03bXR+hzhUFreLTG1IjLQWTCmeZ1u8FJN75Au6Kz9In7CG z6tFnFLe2B0koloEqmn/lMMNqdsNhjefVt/oh4Tvd9rFcXxM+a/J+2nI9ZWva1st o/7c63RfXnfphavl+/UDzsCvXA4HKTDY//KQv5p/c3SnLRne1LiInqx4dr6k6qX3 fR5XrZEdLH1vJ6m6Wi7vbKuNNbAKl8h+6eL5NBlLi6F/y7tg68ngW1qIad4/hC7o /cW2eV0mw5jVMArb6bROXI1dtGnTGDJoPSE4WICJ9wn152cKRl9eoNzG1lggb1vJ Bqf2xl5BhWX8govhxhak67uljw30cnsIIz5K+lRN6j3p8UmWRkkAKLCp9m0869JB muUhjFy4v+my2RevaDmcTw8lBiMnOpfIqhJ8yKCXtmYR7MyZNMAFRpQ/uokV0nai eosiHLXr52HK8m3WnwBh9a1dKLZP0yDbgz7MRDq46aWkC3zzS2hE6sQy266VTiSj 29z1R/KyuDBXfXcia/si =AfRV -----END PGP SIGNATURE----- --I4aLt9CNFmaXkoE30bE7UlLfxQRQJGi3e--