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


Groups > comp.lang.python > #32263

Re: how to change os.popen4 to subprocess

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: how to change os.popen4 to subprocess
Date 2012-10-27 04:10 +0100
References <c6bac1cc-abda-4d95-b3b4-e96dc7ab7a3a@r8g2000pbs.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2929.1351307261.27098.python-list@python.org> (permalink)

Show all headers | View raw


On 27/10/2012 03:28, skyworld wrote:
> Hi,
>
> I'm new to python and I'm trying to porting some scripts from v0.96 to
> v2.0.1. A piece of code is like this:

What software are you talking about here, it's certainly not Python 
versions as the most up to date are 2.7.3 and 3.3.0?

>
> cmd_h = os.popen4(env['SYSCMDLINE'])[1]
>
> the system indicates the popen4 is deprecated and suggest to use
> subprocess. Can anybody tell me how to use subprocess in this case?
> and what does "[1]" here means?

If you don't know what the [1] means you've got problems :)  I suggest 
you read the tutorial here first 
http://docs.python.org/tutorial/index.html then the subprocess module 
here http://docs.python.org/library/subprocess.html#module-subprocess, 
specifically 
http://docs.python.org/library/subprocess.html#subprocess-replacements

>
> thanks.
>

No problem.

-- 
Cheers.

Mark Lawrence.

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


Thread

how to change os.popen4 to subprocess skyworld <chenyong20000@gmail.com> - 2012-10-26 19:28 -0700
  Re: how to change os.popen4 to subprocess MRAB <python@mrabarnett.plus.com> - 2012-10-27 04:02 +0100
    Re: how to change os.popen4 to subprocess skyworld <chenyong20000@gmail.com> - 2012-10-26 23:30 -0700
      RE: how to change os.popen4 to subprocess "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-30 14:47 +0000
  Re: how to change os.popen4 to subprocess Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-27 04:10 +0100

csiph-web