is there a way I can capture that in the code and assign it to a variable?
                  
                  
                  
                  
                  
                  upgradeproc = subprocess.Popen(upgradecmd, shell=True, stdout=stdout_handle, stderr=stderr_handle, preexec_fn=self.demote())
                  
                  
                  
                  
                  
                  stdout,stderr = upgradeproc.communicate() # Always returns NONE
                  
                  
                  
                  
                  
                  https://docs.python.org/2.7/library/subprocess.html#subprocess.Popen.communicate
                  
                  
                
Are you using py2?
Use PIPE in stdout & stderr, then after getting the result of communicate() you can save them on whatever file objects you want
Обсуждают сегодня