Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Protocol: AttributeError: 'NoneType' object has no attribute 'ReadUntilClose' #59

Closed
@eismog

Description

@eismog

Hi,

I will get an error, when I run two error command:

Like this:

import os.path as op

from adb import adb_commands
from adb import sign_m2crypto


# KitKat+ devices require authentication
signer = sign_m2crypto.M2CryptoSigner(
    op.expanduser('~/.android/adbkey'))
# Connect to the device
device = adb_commands.AdbCommands.ConnectDevice(
    rsa_keys=[signer])
# Now we can use Shell, Pull, Push, etc!
# for i in xrange(10):
#   print device.Shell('echo %d' % i)

print device.Shell('ls 333')
print device.Shell('ls 222')
print device.Shell('ls 111')
device.Close()

result:

/usr/bin/python2.7 /home/ligf/PycharmProjects/test-adb/tmp.py
ls: 333: No such file or directory
Traceback (most recent call last):

  File "/home/ligf/PycharmProjects/test-adb/tmp.py", line 18, in <module>
    print device.Shell('ls 222')
  File "build/bdist.linux-x86_64/egg/adb/adb_commands.py", line 227, in Shell
  File "build/bdist.linux-x86_64/egg/adb/adb_protocol.py", line 377, in Command
  File "build/bdist.linux-x86_64/egg/adb/adb_protocol.py", line 405, in StreamingCommand
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'

Process finished with exit code 1

It may be a bug at here:
adb_protocol.py

    if cmd == b'CLSE':
      # Device doesn't support this service.
      return None
    if cmd != b'OKAY':
      raise InvalidCommandError('Expected a ready response, got %s' % cmd,
                                cmd, (remote_id, their_local_id))
    return _AdbConnection(usb, local_id, remote_id, timeout_ms)

BRs
/Eismog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions