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


Groups > comp.lang.python > #24933

Re: how to interact with Windows cmd?

From Nobody <nobody@nowhere.com>
Subject Re: how to interact with Windows cmd?
Date 2012-07-05 17:11 +0100
Message-Id <pan.2012.07.05.16.11.32.514000@nowhere.com>
Newsgroups comp.lang.python
References <5c91bf76-36de-4759-938a-92a9e801e38e@g4g2000pbn.googlegroups.com>
Organization Zen Internet

Show all headers | View raw


On Wed, 04 Jul 2012 20:10:47 -0700, self.python wrote:

> 2. after this, I typed like "cd .." but I/O is already closed so I
> can't do another things..

Don't use .communicate() if you want to keep the child process alive.
Write to p.stdin and read p.stdout and p.stderr.

In general, you'll need to use a separate thread for each stream,
otherwise you risk deadlock. Look at the source code for the
.communicate() method for an example.

Also, unless you specifically need stdout and stderr to be separated, use
"stderr=subprocess.STDOUT". The problem with separating them is that
there's no way to determine the order in which data was written, so
there's no way to reconstruct the output as it would have appeared on the
console.

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


Thread

how to interact with Windows cmd? "self.python" <howmuchistoday@gmail.com> - 2012-07-04 20:10 -0700
  Re: how to interact with Windows cmd? Nobody <nobody@nowhere.com> - 2012-07-05 17:11 +0100
  RE: how to interact with Windows cmd? "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-10 22:29 +0000

csiph-web