Python subprocess.CalledProcessError: Command 'adb devices' returned non-zero exit status 127

15,403

Exit code 127 means "command not found", are you sure you can execute abd from a standard terminal?

Share:
15,403
jen
Author by

jen

Updated on June 14, 2022

Comments

  • jen
    jen almost 2 years

    I am using Ubuntu12.04, and I am seeing below error, it seems to me it's somehow python is trying to call adb command, but failed.

    /bin/sh: 1: adb: not found
    Traceback (most recent call last):
     `File "./test.py", line 1395, in <module>
        main()
      File "./test.py", line 1218, in main
        Device.wait_for_device(TIMEOUT, None, a.getport())
      File "./test.py", line 433, in wait_for_device
        if (len(a) == 1 and get_attached_devices()):
      File "./test.py", line 126, in get_attached_devices
        lines = subprocess.check_output(adb_rel_path + 'adb devices', shell =True).split('\n')
      File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
        raise CalledProcessError(retcode, cmd, output=output)
       subprocess.CalledProcessError: Command 'adb devices' returned non-zero exit status 127
    

    I followed the instructinos to instal pyadb: https://pypi.python.org/pypi/pyadb/0.1.1

    But still it doens't work. I have no clue now. Does anyone know if I am missing any packages or program?