2

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?

jen
  • 21
  • 1
  • 1
  • 2
  • You should post some snippets of your code to go with this. Also, it looks like, it is not that python is missing a package as the adb program/script is not installed where the python script thinks it is (as given by adb_rel_path) – James Matta Oct 11 '13 at 22:48

2 Answers2

5

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

Synthetica
  • 920
  • 1
  • 8
  • 23
  • Yes. adb and fastboot are both added to my $PATH. I also added this to my ~/.bashrc ----->export PATH=$PATH:/opt/jdk1.6.0_45/bin:~/android-sdk/platform-tools:~/android-sdk/tools:/usr/local/lib/python2.7/dist-packages/pyadb. adb devices also work under terminal. – jen Oct 11 '13 at 22:34
  • And what's the return of `subprocess.call(["adb", "devices"])`? – Synthetica Oct 11 '13 at 22:55
  • The problem is that OP's PATH is being set in `~/.bashrc`, which Python does not read. – Kevin Apr 23 '15 at 13:25
  • Yeah, I agree with Kevin. Probably you should try whether you can install the rpogram into folder like `/usr/bin/` – sikisis Oct 03 '16 at 19:45
0

I had the same exception, while I did try to install two versions of python via buidout. So I had to install build-essential, so buildout can execute make command.

sudo apt-get install build-essential
Taras Vaskiv
  • 2,215
  • 1
  • 18
  • 17