sl4a
sl4a copied to clipboard
When scanning a barcode, SCAN_RESULT_BYTES is a strange format.
https://github.com/kuri65536/python-for-android/issues/63
SCAN_RESULT_BYTES is not bytes array in python.
def _rpc(self, method, *args):
data = {'id': self.id,
'method': method,
'params': args}
request = json.dumps(data)
self.client.write(request+'\n')
self.client.flush()
response = self.client.readline()
self.id += 1
result = json.loads(response)
if result['error'] is not None:
In self.client.readline(), response is already contains the converted string 'SCAN_RESULT_BYTES'.