I have code, this is the standard command for stdout.
params = [toolsDir + "\\adb.exe", "shell", "pm", "path", app]
p = Popen(params, shell=False, stdout=subprocess.PIPE)
stdout, stderr = p.communicate()
if "package:" in stdout:
package = stdout[8:].rstrip()
Line 3 returns the line, since line 5 works successfully without errors, I can split rstrip () into a "package".
stdout, stderr = p.communicate()
However ... if I remove 'stderr' from line 3, then it ends as
stdout = p.communicate()
I get an error message:
package = stdout[8:].rstrip()
AttributeError: 'tuple' object has no attribute 'rstrip'
Can someone explain why this happens, since stderr is not even defined for the channel in line 2 of Popen, so why does it return a tuple without stderr, but a line with it?
I have already fixed this problem, although it took me 30 minutes, and now I want to know why this matters. Thanks.
source
share