2017-01-12 3 views
0


Ich möchte Adb-Befehle von Python ausführen und ich habe googles eigene Bibliothek dafür gefunden, aber es funktioniert nicht.
https://github.com/google/python-adb

Dies ist der Code habe ich verwendet: (Es ist aus dem Beispiel)
ADB aus Python verwenden

import os.path as op 

from adb import adb_commands 
from adb import sign_m2crypto 

signer = sign_m2crypto.M2CryptoSigner(
    op.expanduser('~/.android/adbkey')) 

device = adb_commands.AdbCommands.ConnectDevice(rsa_keys=[signer]) 

Dies ist der Fehler, den ich bekommen:

Traceback (most recent call last): 
    File "/home/elichai2/PycharmProjects/Test/python_adb.py", line 9, in <module> 
    device = adb_commands.AdbCommands.ConnectDevice(rsa_keys=[signer]) 
    File "/usr/local/lib/python2.7/dist-packages/adb/adb_commands.py", line 76, in ConnectDevice 
    return cls.Connect(handle, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/adb/adb_commands.py", line 99, in Connect 
    device_state = cls.protocol_handler.Connect(usb, banner=banner, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/adb/adb_protocol.py", line 277, in Connect 
    cmd, arg0, arg1, banner = cls.Read(usb, ['CNXN', 'AUTH']) 
    File "/usr/local/lib/python2.7/dist-packages/adb/adb_protocol.py", line 235, in Read 
    actual_checksum = cls.CalculateChecksum(data) 
    File "/usr/local/lib/python2.7/dist-packages/adb/adb_protocol.py", line 187, in CalculateChecksum 
    return sum(map(ord, data)) & 0xFFFFFFFF 
TypeError: ord() expected string of length 1, but int found 

Irgendwelche Ideen?

+0

Same here ... Ich habe gerade Problem auf Github Seite: https://github.com/google/python-adb –

Antwort

1

Sie können versuchen AndroidViewClient/culebraadbclient.py, die ein ADB-Client in Python implementiert ist.

Dies ist ein simple example von wie AdbClient allein ohne AndroidViewClient zu verwenden.

+0

Ich brauche werde ihr ganzes Projekt verwenden, weil sie bekam viele interne Abhängigkeiten (und sie hängen von mehr Dateien im Projekt ab) – elichai2

+0

's/its/your /' - Diego ist der Autor von 'AVC' –