如何获得"adb设备"与env一起使用Popen()时可以正常工作 [英] how to get "adb device" to work when using Popen() with env
问题描述
原始代码为
在没有 it works fine without 使用env变量执行有关 exec any command about 在杀死adb服务器后似乎不起作用 it seems not to work after kill the adb server 整个输出为此处 OS:win7 我怀疑adb还需要其他环境变量(例如 I suspect adb also needs other environment variables (like 从文档中 看来,这与恩文本身无关.
相反,如果设置了 It seems, it's not about the envoronment itself.
Rather the adb server is broken if 这篇关于如何获得"adb设备"与env一起使用Popen()时可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!env={'ADB_TRACE':'adb'}
的情况下可以正常工作.env={'ADB_TRACE':'adb'}
.adb
的任何命令,我得到一个错误:adb
with the env variable, i got an error:ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
推荐答案
$HOME
).
您应该克隆现有环境,然后在其中添加ADB_TRACE
.$HOME
).
You should clone your existing environment and add ADB_TRACE
to it.import os
new_env = os.environ.copy()
new_env['ADB_TRACE'] = 'adb'
# sp.popen()
If env is not None, it must be a mapping that defines the environment variables
for the new process; these are used instead of inheriting the current process’
environment, which is the default behavior.
ADB_TRACE
,则adb服务器将损坏.
尝试在没有ADB_TRACE
的环境中预先启动服务器.ADB_TRACE
is set.
Try to start the server beforehand in an environment without ADB_TRACE
.