You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
Repository navigation
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
I will get an error, when I run two error command:
Like this:
importos.pathasopfromadbimportadb_commandsfromadbimportsign_m2crypto# KitKat+ devices require authenticationsigner=sign_m2crypto.M2CryptoSigner(
op.expanduser('~/.android/adbkey'))
# Connect to the devicedevice=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)printdevice.Shell('ls 333')
printdevice.Shell('ls 222')
printdevice.Shell('ls 111')
device.Close()
Can you add this between line 253 and 254 of adb/adb_protocol.py: print command
Then run it again and paste the output here, please. This should only be happening if the device is either sending two CLSE responses or the library isn't handling the first CLSE in time.
Hi
the print output is here. The number 0 is the output of the first loop, the item in buckets are the output of print(command, arg0, arg1, bytes(data))
('AUTH', 1, 0, '\r\xbf_\xa5]\xbdUi\xbc\x02\x10n\x8f\xe2\xf9p\x17I:Y')
('CNXN', 16777216, 4096, 'device::ro.product.name=FRD-AL00;ro.product.model=FRD-AL00;ro.product.device=HWFRD;features=cmd,shell_v2')
('OKAY', 8, 1, '')
('WRTE', 8, 1, '0\n')
('CLSE', 8, 1, '')
0
('CLSE', 8, 1, '')
Traceback (most recent call last):
File "test.py", line 24, in <module>
print device.Shell('echo %d' % i)
File "build/bdist.macosx-10.12-x86_64/egg/adb/adb_commands.py", line 227, in Shell
File "build/bdist.macosx-10.12-x86_64/egg/adb/adb_protocol.py", line 386, in Command
File "build/bdist.macosx-10.12-x86_64/egg/adb/adb_protocol.py", line 414, in StreamingCommand
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'
Here's the output of print:
CNXN
OKAY
WRTE
CLSE
Traceback (most recent call last):
File "//installer.py", line 129, in
device.Shell("echo 2")
File "build/bdist.macosx-10.13-intel/egg/adb/adb_commands.py", line 233, in Shell
File "build/bdist.macosx-10.13-intel/egg/adb/adb_protocol.py", line 383, in Command
File "build/bdist.macosx-10.13-intel/egg/adb/adb_protocol.py", line 411, in StreamingCommand
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'
CLSE
This fixes the issue (in the Open method), I'm not sure if it's the best fix though:
if cmd == b'CLSE':
# Some devices send two CLSEs
cmd, remote_id, their_local_id, _ = cls.Read(usb, [b'CLSE', b'OKAY'],
timeout_ms=timeout_ms)
# Device doesn't support this service.
if cmd == b'CLSE':
return None
File "/usr/lib/python2.7/site-packages/adb/adb_commands.py", line 366, in Shell
timeout_ms=timeout_ms)
File "/usr/lib/python2.7/site-packages/adb/adb_protocol.py", line 406, in Command
return ''.join(cls.StreamingCommand(usb, service, command, timeout_ms))
File "/usr/lib/python2.7/site-packages/adb/adb_protocol.py", line 434, in StreamingCommand
for data in connection.ReadUntilClose():
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'
And my adb_protocol.py already contained
if cmd == b'CLSE':
# Some devices send two CLSEs
cmd, remote_id, their_local_id, _ = cls.Read(usb, [b'CLSE', b'OKAY'],
timeout_ms=timeout_ms)
# Device doesn't support this service.
if cmd == b'CLSE':
return None
Any help would be greatly appreciated as it seems to fail randomly and during periods of high ADB traffic.
@alxhoff Thanks for the confirmation. If Google loves open source so much it'd be great if they gave developers of their open-source projects the time necessary to review and merge bug fixes to them 😀 😀 😀
For myself I'll probably be forced to distribute my own fork of this package.
Activity
myrfy001 commentedon Oct 13, 2017
The same problem. Has it been solved?
My phone is Huawei Honor 8.
fahhem commentedon Oct 13, 2017
Can you add this between line 253 and 254 of
adb/adb_protocol.py:print commandThen run it again and paste the output here, please. This should only be happening if the device is either sending two
CLSEresponses or the library isn't handling the firstCLSEin time.myrfy001 commentedon Oct 13, 2017
Hi
the print output is here. The number
0is the output of the first loop, the item in buckets are the output ofprint(command, arg0, arg1, bytes(data))MohammadAG commentedon Jan 22, 2018
This also seems to be a problem on an LG G6
Here's the output of print:
CNXN
OKAY
WRTE
CLSE
Traceback (most recent call last):
File "//installer.py", line 129, in
device.Shell("echo 2")
File "build/bdist.macosx-10.13-intel/egg/adb/adb_commands.py", line 233, in Shell
File "build/bdist.macosx-10.13-intel/egg/adb/adb_protocol.py", line 383, in Command
File "build/bdist.macosx-10.13-intel/egg/adb/adb_protocol.py", line 411, in StreamingCommand
AttributeError: 'NoneType' object has no attribute 'ReadUntilClose'
CLSE
This fixes the issue (in the Open method), I'm not sure if it's the best fix though:
alxhoff commentedon Feb 19, 2019
I am still affected by this issue
And my adb_protocol.py already contained
Any help would be greatly appreciated as it seems to fail randomly and during periods of high ADB traffic.
alxhoff commentedon Apr 2, 2019
Bump. This is plaguing my app like nothing else.
alxhoff commentedon Apr 2, 2019
After having a fresh google around PR #151 seems to of fixed it up.
embray commentedon Apr 7, 2019
@alxhoff Thanks for the confirmation. If Google loves open source so much it'd be great if they gave developers of their open-source projects the time necessary to review and merge bug fixes to them 😀 😀 😀
For myself I'll probably be forced to distribute my own fork of this package.