the original code is here
import subprocess as sp
cmd = ["adb","push","file","/mnt/sdcard/file"]
mysp = sp.popen(cmd, env={'ADB_TRACE':'adb'}, stdout=sp.PIPE, stderr=sp.PIPE)
stdout,stderr = mysp.communicate()
if mysp.returncode != 0:
print stderr
else:
print stdout
it works fine without env={'ADB_TRACE':'adb'}
.
exec any command about adb
with the env variable, i got an error:
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
it seems not to work after kill the adb server
the whole output is here
OS:win7
I suspect adb also needs other environment variables (like
$HOME
). You should clone your existing environment and addADB_TRACE
to it.From the docs:
Edit:
It seems, it's not about the envoronment itself. Rather the adb server is broken if
ADB_TRACE
is set. Try to start the server beforehand in an environment withoutADB_TRACE
.