Bug #10001
closedpython3 multiple errors and warnings
0%
Description
Chirp from the last py3 branch commit (5da559ffde25) has several warnings and errors during program start and usage.
The errors were observed on a system running Ubuntu 22.04 with Python 3.10.4.
I have patched all errors and warnings observed during program start - the fixes span many files for models of radio that I do not have for testing.
Additional errors and warnings were observed and fixed while interacting with the radio Baofeng BF-F8HP.
Other radios models will likely need additional similar fixes that can be patterned after my patch.
My fixes are not intended to change the functional behavior of chirp.
The below are the category of errors inferred from the fixes that I have already made sorted from most to least occurrences:
- python2's print keyword must be changed to python3's print() function;
- from future import print_function #for python2 compatibility
- python2 vs python3 exception syntax; s/except Exception, e:/except Exception as e:/
- python3 doesn't have xrange(), use range() ; s/xrange/range/
- python3 expects explicit relative imports
- python2' implicit integer division results in type mismatches and should be replaced with // operator or floordiv
- list(range(...)) in some places because range() produces iterator
- string UTF-8 encode for concatenation of string to bytes
- s/string.uppercase/string.ascii_uppercase/
- python3 removed Tuple Parameter Unpacking
This list or similar will be included in the commit message.
Files
Updated by Nathan Kohagen over 2 years ago
Updated by Dan Smith about 2 years ago
- Status changed from New to Closed
- Target version changed from chirp-py3 to chirp-legacy
Python3 development is being done in the py3 branch of the github repo here:
https://github.com/kk7ds/chirp
I expect all your changes are fixed there already as it's running well, but feel free to propose additional PRs.