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.

Demo code does not work #39

Closed
Closed

Description

@direvius

Seems like adb connection is closed after each Shell comand:

95:automation direvius$ python ./cmd.py
0

Traceback (most recent call last):
  File "./cmd.py", line 16, in <module>
    print device.Shell('echo %d' % i)
  File "/usr/local/lib/python2.7/site-packages/adb/adb_commands.py", line 227, in Shell
    timeout_ms=timeout_ms)
  File "/usr/local/lib/python2.7/site-packages/adb/adb_protocol.py", line 369, in Command
    return ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
  File "/usr/local/lib/python2.7/site-packages/adb/adb_protocol.py", line 394, in StreamingCommand
    for data in connection.ReadUntilClose():
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'

It works when there are ConnectDevice calls before every Shell

Activity

  1. fahhem commented on Jun 8, 2017

    @fahhem
    Contributor

    Which example code is this, and what version of Python? Please retry from head (or the latest PyPI release 1.2.0)

  2. Manabu-GT commented on Sep 8, 2017

    @Manabu-GT

    @fahhem

    I'm running the example code on README and got the same error.
    I installed the latest release 1.2.0 through "pip install adb".
    The python version is "Python 2.7.13". It is LG's G6 running Android 7.0 which I'm currently testing with.

    Traceback (most recent call last):
      File "test.py", line 25, in <module>
        print device.Shell('echo %d' % i)
      File "/usr/local/lib/python2.7/site-packages/adb/adb_commands.py", line 227, in Shell
        timeout_ms=timeout_ms)
      File "/usr/local/lib/python2.7/site-packages/adb/adb_protocol.py", line 376, in Command
        return ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
      File "/usr/local/lib/python2.7/site-packages/adb/adb_protocol.py", line 404, in StreamingCommand
        for data in connection.ReadUntilClose():
    AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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