-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
Environment
- Python 3.7 or Python 3.8
Reproduction steps
- Bluetooth pairing
python pbapclient.pyconnect 20:20:0F:32:D3:29(use your device ID)
Actual result:
TypeError: can't concat str to bytes
More info, with stack:
2020-06-18 18:46:25,120 __main__ INFO Connecting to pbap server = (20:20:0F:32:D3:29, 19)
...
File "pbapclient.py", line 168, in do_connect
result = self.client.connect(header_list=[headers.Target(service_id)])
File ".../pypbap/run/lib/python3.7/site-packages/PyOBEX-0.28-py3.7.egg/PyOBEX/headers.py", line 33, in __init__
self.data = self.encode(data)
File ".../pypbap/run/lib/python3.7/site-packages/PyOBEX-0.28-py3.7.egg/PyOBEX/headers.py", line 48, in encode
return struct.pack(">BH", self.code, len(data) + 3) + data
TypeError: can't concat str to bytes
EXCEPTION of type 'TypeError' occurred with message: 'can't concat str to bytes'
Expected result
2020-06-18 18:46:25,120 __main__ INFO Connecting to pbap server = (20:20:0F:32:D3:29, 19)
2020-06-18 18:46:25,246 __main__ INFO Connect success
Cause
service_id is given as string, and then concatenated with bytes in PyOBEX. That is now invalid in Python 3.8.
Fix
service_id must be written as bytes literal, according to PEP 3112
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels