ATX launch atx-agent daemon 失败解决办法

奋斗的鸡腿 · May 18, 2018 · Last by Paprier replied at January 16, 2019 · 1989 hits

参考https://testerhome.com/topics/11588
安装 atx-agent 环境时遇到
2018-05-18 13:58:35,549 - main.py:254 - INFO - atx-server addr 192.168.137.104:8000
2018-05-18 13:58:35,572 - main.py:269 - INFO - Detect pluged devices: [u'192.168.137.118:5555']
2018-05-18 13:58:35,572 - main.py:286 - INFO - Device(192.168.137.118:5555) initialing ...
2018-05-18 13:58:35,842 - main.py:113 - INFO - install minicap
2018-05-18 13:58:36,160 - main.py:120 - INFO - install minitouch
2018-05-18 13:58:36,407 - main.py:137 - INFO - apk(1.0.14) already installed, skip
2018-05-18 13:58:36,509 - main.py:175 - INFO - atx-agent(0.3.2) already installed, skip
2018-05-18 13:58:36,648 - main.py:212 - INFO - launch atx-agent daemon
2018-05-18 13:58:41,788 - main.py:238 - ERROR - failur
这个错误,提示无法启动 atx-agent

后来在 shell 里模拟启动该服务发现不加-d 参数是可以正常启动的:/data/local/tmp/atx-agent 可以正常启动该服务。
所以修改启动参数 uiautomator2/main.py 中第 215 行

去掉参数 ‘-d’
然后再启动,发现程序一直不往下继续进行,一直卡在启动 atx-agent 服务上,但是服务已经成功启动了。
所以继续查代码。
经过阅读大神的代发发现 adbutils.py 这个文件中第 41 行中所用到的 subprocess.check_output() 是 pyton3 的方法,在 python2.7 中根本没法用。
所以修改了下 uiautomator2/adbutils.py 中该行代码,用 subprocess.Popen 代替:

就可以启动成功了。
然后就可以正常运行了。

共收到 3 条回复 时间 点赞

python2.7 有 check_output 这个方法呀

Python 2.7.15 (default, May  6 2018, 19:27:01) 
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.check_output
<function check_output at 0x107d04c08>
>>> 
codeskyblue 回复

是的,有这个方法,一直没往下继续进行是因为,subprocess.check_output 起的子进程一直不结束导致的。 是我看错了。

启动去掉-d 倒是可以了,一直不往下进行的问题按上面改了还是存在。。

需要 Sign In 后方可回复, 如果你还没有账号请点击这里 Sign Up