Project

General

Profile

Actions

Bug #9541

open

Cannot Download from TYT TH-7800: local variable 'ack' referenced before assignment

Added by Patrick Snyder over 2 years ago. Updated 11 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Start date:
11/12/2021
Due date:
% Done:

0%

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

Description

I'm having an issue downloading the data from my TYT TH7800. I have seen other users report something similar in the past and a bug fix was generally pushed out for their specific radio/scenario.

@ERROR: Failed to clone: Failed to communicate with the radio: local variable 'ack' referenced before assignment@

Tried to dig into it myself and contribute but just don't have time at the moment. I was able to run chirp on another linux box running Raspbian (which looks to be executing chirpw using python2.7) and that version downloads and uploads to the radio just fine, however the kali linux box I want to run chirp on looks to execute it in python3.9 which seems to be causing the issue. I've isolated it to the th7800.py driver file, the _identify function, and can see when the 'ack' variable is attempting to be referenced (line 577 of ..chirp/drivers/th7800.py) I assume older versions of python were either less strict about variable references or, more likely, one of the earlier functions that gets the data to set that ack variable are failing in python3 and cascading down to this point.

def _identify(radio):
    """Do identify handshake with TYT"""
    try:
        radio.pipe.write("\x02SPECPR")
        ack = radio.pipe.read(1)
        if ack != "A":
            util.hexprint(ack)
            raise errors.RadioError("Radio did not ACK first command: %x"
                                    % ord(ack))
    except:
        LOG.debug(util.hexprint(ack))
        raise errors.RadioError("Unable to communicate with the radio")

    radio.pipe.write("G\x02")
    ident = radio.pipe.read(16)
    radio.pipe.write("A")
    r = radio.pipe.read(2)
    if r != "A":
        raise errors.RadioError("Ack failed")
    return ident

Then again I could be totally wrong about all this...its been a while since I've dug into some python code. Thanks for the help.

Radio info:
Trying to download from a TYT TH7800.

Version info:
CHIRP 0.3.0dev on Linux kalishack 5.14.0-kali2-amd64 #1 SMP Debian 5.14.9-2kali1 (2021-10-04) x86_64 (Python 3.9.7)


Files

chirp_debug-uq30smuz.txt (2.44 KB) chirp_debug-uq30smuz.txt Jason V, 05/20/2023 03:22 PM
Actions #1

Updated by Jason V 11 months ago

I know this is an old issue but I'm seeing the same thing. Cable is the one that came with the device. Debug log is attached.

Actions

Also available in: Atom PDF