我正在尝试从通过python连接的ADB设备中提取屏幕截图。
我没有使用从运行良好的设备上捕获它,而是尝试使用exec-out
adb exec-out screencap -p > D:\\Screenshot.png
这在命令提示符下有效,但是当我在python子进程中尝试此操作时,未获取屏幕截图
args = ['adb','exec-out','screencap','-p','>','D:\\Screenshot.png']
cmdp = subprocess.Popen(args, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
self.__output, self.__error = cmdp.communicate()
retcode = cmdp.wait()
代码执行没有任何错误,但是屏幕截图并未提取。
请帮助:)
答案 0 :(得分:0)
请使用shell = True进行子进程。Popen。