google / python-adb

Python ADB + Fastboot implementation
Apache License 2.0
1.8k stars 357 forks source link

TypeError: from_buffer() cannot return the address of a unicode object #159

Closed g1im2 closed 5 years ago

g1im2 commented 5 years ago

code like this: signer = sign_cryptography.CryptographySigner(os.path.expanduser('~/.android/adbkey')) device = adb_commands.AdbCommands()

def __init__(self):
    AdbHelper.device = adb_commands.AdbCommands()
    AdbHelper.device.ConnectDevice(rsa_keys=[AdbHelper.signer])

if running this, the error will be happened, i install from setup use lasted code in github, what's happend, can help me

g1im2 commented 5 years ago

i am sorry, the information less, i use ubuntu 18.04 and running adb with 1.0.41 vesion. clone this project and use setup.py to install. if i use sign_pycryptodome type to connect device, it can't auth and always throw the exception with DeviceAuthError if i run program. and i try working with sign_cryptography type to hope it can solve authError, but this error was happened, i don't know how to fix or skip it.

anthonybm commented 5 years ago

Did you resolve this issue? I have the same error on OSX running "pyadb shell". The .pub key should be valid.

hamdya commented 5 years ago

You need to modify line 33 of sign_cryptography.py to add .encode('ascii') as follows: sa_prv_file.read().encode('ascii'), None, default_backend())