Export to CSV failing when no row selected
I have an Icom-7100. I can download from the radio OK. There are two cases where the export to CSV fails. 1) If no rows are selected. 2) if row 0 and other rows are selected. If I select valid rows, it works. On failure I get:
ERROR: <function ChirpEditorSet.export_to_file at 0x7063e0c2d300> raised unexpected exception Traceback (most recent call last): File "/home/andy/.local/pipx/venvs/chirp/lib/python3.12/site-packages/chirp/wxui/common.py", line 642, in run_safe return fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/andy/.local/pipx/venvs/chirp/lib/python3.12/site-packages/chirp/wxui/main.py", line 325, in export_to_file current.export_to_file(filename) File "/home/andy/.local/pipx/venvs/chirp/lib/python3.12/site-packages/chirp/wxui/memedit.py", line 2247, in export_to_file m = self._memory_cache[row] ~~~~~~~~~~~~~~~~~~^^^^^ KeyError: 0
This seems to be from site-packages/chirp/wxui/memedit.py:
def export_to_file(self, filename): if not filename.lower().endswith('.csv'): raise Exception(_('Export can only write CSV files')) selected = self._grid.GetSelectedRows() if len(selected) <= 1: selected = range(0, self._grid.GetNumberRows()) -------------------------------------^ When no rows are selected, the range includes 0. If you start from 1, it works
print("selected: ",selected) r = generic_csv.CSVRadio(None) # The CSV driver defaults to a single non-empty memory at location # zero, so delete it before we go to export. r.erase_memory(0) for row in selected: m = self._memory_cache[row]
This is using chirp-20241108-py3-none-any.whl
I'm not sure if some radios may actually start at memory zero. The comment about deleting row zero would seem to indicate that is not the case.
Thanks, Andy - KF5JLJ
Thanks
Hi Andrew,
This is the users list, so not really the best place to discuss development issues and deep bugs like this. If you would, please file a bug on the site per these instructions:
https://www.chirpmyradio.com/projects/chirp/wiki/How_to_report_issues
so we can have a look.
I have an Icom-7100. I can download from the radio OK. There are two cases where the export to CSV fails. 1) If no rows are selected. 2) if row 0 and other rows are selected. If I select valid rows, it works. On failure I get:
...
I'm not sure if some radios may actually start at memory zero. The comment about deleting row zero would seem to indicate that is not the case.
Many radios start at zero (including your 7100), and also there should *always* be a row zero regardless of the origin of the memory bounds of the radio. My guess would be that we failed to load _your_ memory zero due to a bug in the driver, that row is marked as an error, and thus the export is failing to be able to capture it. All of that will be more obvious with your debug log and full report based on the instructions above and I'll be happy to dive in.
Thanks!
--Dan
I'm not sure if some radios may actually start at memory zero. The
comment about deleting row zero would seem to indicate that is not the case.
Many radios start at zero (including your 7100), and also there should *always* be a row zero regardless of the origin of the memory bounds of the radio. My guess would be that we failed to load _your_ memory zero due to a bug in the driver, that row is marked as an error, and thus the export is failing to be able to capture it. All of that will be more obvious with your debug log and full report based on the instructions above and I'll be happy to dive in.
The driver init for the 7100 tells Chirp that its memories start at 0, as does the init for the 7000. All of the other radios in that driver tell Chirp they start at 1. When I wrote the code for the 910, I remember initially using the 7100 code as a reference, but being puzzled as to why it started at 0, when the manual says the memories are numbered 1-99. I initially followed suit, but starting at 0 did not work for the 910, which also numbers its memories from 1-99. I don't have a 7100, so I couldn't test, but just wanted to mention that here in case that code really should be starting at 1 instead of 0.
Martin. KD6YAM
The driver init for the 7100 tells Chirp that its memories start at 0, as does the init for the 7000. All of the other radios in that driver tell Chirp they start at 1. When I wrote the code for the 910, I remember initially using the 7100 code as a reference, but being puzzled as to why it started at 0, when the manual says the memories are numbered 1-99. I initially followed suit, but starting at 0 did not work for the 910, which also numbers its memories from 1-99. I don't have a 7100, so I couldn't test, but just wanted to mention that here in case that code really should be starting at 1 instead of 0.
The manual says 1-99, so perhaps this was just an error in the driver since forever. In that case, filing the bug may just end up with that change and a module for the OP to test/confirm.
--Dan
participants (3)
-
andy@gamubaru.com
-
Dan Smith
-
Martin Cooper