Project

General

Profile

Actions

Bug #10001

closed

python3 multiple errors and warnings

Added by Nathan Kohagen over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
08/23/2022
Due date:
% Done:

0%

Estimated time:
Chirp Version:
daily
Model affected:
(All models)
Platform:
All
Debug Log:
I read the instructions above:

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

chirp-py3-issue10001.patch (66.2 KB) chirp-py3-issue10001.patch Nathan Kohagen, 09/09/2022 03:16 AM
Actions #2

Updated by Dan Smith over 1 year 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.

Actions

Also available in: Atom PDF