subprocess.Popen instance hangs

Tim Johnson tim at akwebsoft.com
Thu Aug 29 21:00:21 EDT 2013


* Tim Johnson <tim at 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



More information about the Python-list mailing list