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


Groups > comp.lang.python > #90880

Re: Best way to rewrite Popen

Date 2015-05-19 19:43 +0200
From Jonas Wielicki <jonas@wielicki.name>
Subject Re: Best way to rewrite Popen
References <87siastsby.fsf@Equus.decebal.nl>
Newsgroups comp.lang.python
Message-ID <mailman.147.1432057412.17265.python-list@python.org> (permalink)

Show all headers | 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