Bug #10001

python3 multiple errors and warnings

Added by Nathan Kohagen about 1 month ago. Updated 27 days ago.

Status:New Start date:08/23/2022
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:chirp-py3
Chirp Version:daily Platform:All
Model affected:(All models)

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.

chirp-py3-issue10001.patch (66.2 kB) Nathan Kohagen, 09/09/2022 03:16 am

History

Also available in: Atom PDF