Bug #9927
closedFailed to clone: module 'collections' has no attribute 'Callable'
0%
Description
Chirp 0.3.0dev on Python 3.10.4 wxPython 4.0.7 gtk3 (phoenix) wxWidgets 3.0.5
Pop!_OS 22.04 LTS
When cloning from a Baofeng BF-F8HP on Pop-OS 22.04 (basically Ubuntu), the clone completes (the loading bar is full), then the following error message is immediately displayed, and the clone fails.
Failed to clone: module 'collections' has no attribute 'Callable'
I see this in the terminal output (in the terminal I used to launch chirpw
ERROR: Failed to clone: module 'collections' has no attribute 'Callable'
ERROR: uv5r._ident_radio: Radio did not respond
ERROR: Failed to clone: Radio did not respond
ERROR: Failed to clone: module 'collections' has no attribute 'Callable'
I see this in logs
[2022-06-24 09:09:49,664] chirp.drivers.uv5r - INFO: Radio Version is b'N5R340B \xff\xff\xff\xff\xff\xff'
[2022-06-24 09:09:49,664] chirp.drivers.uv5r - DEBUG: downloading main block...
[2022-06-24 09:10:03,332] chirp.drivers.uv5r - DEBUG: done.
[2022-06-24 09:10:03,332] chirp.drivers.uv5r - DEBUG: downloading aux block...
[2022-06-24 09:10:04,043] chirp.drivers.uv5r - DEBUG: done.
[2022-06-24 09:10:04,044] chirp.wxui.clone - ERROR: Failed to clone: module 'collections' has no attribute 'Callable'
Files
Updated by Bruce Emehiser about 2 years ago
There is now a known solution, which was provided to me via email.
Hi Bruce.
Don't know if you have solved it but I've had the same problem you had with CHIRP. I have Ubuntu too and trying to find a solution I founded your report.
The problem appeared when I upgraded certain system files so I found this problem:
When upgrading the python files, the module collections give you the ABC method Callable.
The chirp file pyPEG.py call this method as "collections.Callable" three times.
You can found the file under: /usr/lib/python3/dist-packages/chirp/I've try this solution and works fine for me:
duplicate the file pyPEG.py and save the copy with another name (only for backup, I use to do so)
edit pyPEG.py with root permission (sudo...)
substitute the three calls "collections.Callable" with "collections.abc.Callable", so the line remains like isinstance(pattern, collections.abc.Callable):That works for me.
Regards, Tomy.
I'm guessing we should add conditional checking to try collections.abc.Callable, and fallback to collections.Callable if that doesn't exist. Does anyone know the correct process for making those changes, or how I would go about making them and submitting a pull request?
Updated by Tony Fuller about 2 years ago
Hi Bruce,
Dan accepts pull requests on github.com and also via mailing list (I can't get emails from the mailing list since outlook.com appears to be silently blocking them so I go through github.com). https://github.com/kk7ds/chirp/tree/py3
The developer mailing list is at http://intrepid.danplanet.com/mailman/listinfo/chirp_devel
and the mercurial "how to" page is at https://chirp.danplanet.com/projects/chirp/wiki/DevelopersProcess
I'm guessing we should add conditional checking to try collections.abc.Callable, and fallback to collections.Callable
Python2 is dead. In my opinion, I would target the py3 branch, use only the python 3 syntax (e.g. from collections.abc import Callable), and only make changes which you're able to test :) This will make things a lot smoother if anything comes up.
Tony
Updated by Bruce Emehiser about 2 years ago
It looks like the bug has already been fixed in the py3
branch on Github, so I guess I'll close this ticket and just use that branch until it is merged to master and released.
https://github.com/kk7ds/chirp/pull/14/files
Many thanks for all the help.