Multiple fixes to bring the code to work with latest version of Python3#1
Open
nrathaus wants to merge 13 commits intosraodev:masterfrom
Open
Multiple fixes to bring the code to work with latest version of Python3#1nrathaus wants to merge 13 commits intosraodev:masterfrom
nrathaus wants to merge 13 commits intosraodev:masterfrom
Conversation
nrathaus
commented
Feb 26, 2023
- Styling and coding that work with Python3
- Move to newer version of pybluez and pickle
- Better handling of errors
- Send data as bytes and receive it as bytes
- Retry connections in case it (previously) failed
sraodev
pushed a commit
that referenced
this pull request
Apr 30, 2026
PR #1 was opened against the original root-level scripts in 2023 and no longer applies cleanly to the refactored sdk/python/ tree, but two of its fixes are still real and weren't ported during the refactor. - ClientSettings: connect_retries (default 5) and connect_backoff_seconds (default 1.0). Mirrors the discovery_retries / discovery_backoff_seconds pattern already in place. - ClientSocketManager.connect(): wrap the connect call in a retry loop with the configured backoff. Bluetooth connect() is genuinely flaky in practice; the original PR did this with a hardcoded attempt > 5 guard, here it is config-driven and logs per attempt. Last error is preserved as the raised BluetoothServerError's cause. - install_dependencies.sh + sdk/python/README: install pybluez from github.com/pybluez/pybluez instead of PyPI. The PyPI distribution hasn't been updated in years and fails to build on Python 3.10+. Not adopted from PR #1: - Binary 2-byte little-endian length framing — caps payloads at 64KB and would regress the current decimal-string framing on both sides. - bare-Exception catches and sys.exit(0) on failure — the current module raises typed BluetoothClientError / BluetoothServerError, which is strictly better for callers and tests. Smoke-tested the retry path with a stubbed bluetooth module (3 attempts with 0.01s backoff completed in ~20ms; each attempt logged; final exception carried the BluetoothError cause).
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.