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


Groups > comp.lang.python > #53266

Re: subprocess.Popen instance hangs

Date 2013-08-29 17:00 -0800
From Tim Johnson <tim@akwebsoft.com>
Subject Re: subprocess.Popen instance hangs
References <20130829183418.GE414@mail.akwebsoft.com>
Organization AkWebsoft
Newsgroups comp.lang.python
Message-ID <mailman.377.1377824422.19984.python-list@python.org> (permalink)

Show all headers | View raw


* Tim Johnson <tim@akwebsoft.com> [130829 10:51]:
> using Python 2.7.1 on OS X 10.7.5
> 
> I'm managing a process of drush using an instance of subprocess.Popen
<...> 
## This appears to be what works. 
    def __exec(self,args) :
        """Run the process with arguments"""
       p = subprocess.Popen(args,stderr=subprocess.PIPE,stdout=subprocess.PIPE)
       while 1 :
           output = p.stdout.read()
           if output :
               print(output)
           else : break
       errmsg = p.communicate()[1]
       if errmsg :
           self.__err('Process terminated with error:',errmsg)
## Thanks again, gnarly one for me. I am eternally a noob!

-- 
Tim 
tim at tee jay forty nine dot com or akwebsoft dot com
http://www.akwebsoft.com

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


Thread

Re: subprocess.Popen instance hangs Tim Johnson <tim@akwebsoft.com> - 2013-08-29 17:00 -0800
  Re: subprocess.Popen instance hangs Nobody <nobody@nowhere.com> - 2013-08-30 15:47 +0100
    Re: subprocess.Popen instance hangs Tim Johnson <tim@akwebsoft.com> - 2013-08-30 07:32 -0800
    Re: subprocess.Popen instance hangs Jerry Hill <malaclypse2@gmail.com> - 2013-08-30 11:38 -0400
    Re: subprocess.Popen instance hangs Tim Johnson <tim@akwebsoft.com> - 2013-08-30 10:43 -0800

csiph-web