0

I am trying to pull a screenshot from an ADB device connected from python.

Instead of capturing and pulling it from the device which works well, I tried to use exec-out

adb exec-out screencap -p > D:\\Screenshot.png

This works from command prompt but when I try this from python subprocess, screenshot is not fetched

 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()

The code executes without any error but the screenshot is not pulled.

Please help :)

Azeeb
  • 81
  • 11

1 Answers1

0

Please try with shell=True for subprocess.Popen.

Sreejith
  • 46
  • 1
  • 5