From 1b265222e6fb3db6f9e30d27b771c018dd743034 Mon Sep 17 00:00:00 2001 From: James O'Shannessy <12959316+joshanne@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:47:21 +1100 Subject: [PATCH] hwdef: Update scripts to parse CSV files properly fails because of iterator not returning strings and 'dict' object has no attribute 'iterkeys'. Fixed so both scripts run. --- libraries/AP_HAL_ChibiOS/hwdef/scripts/addfunc_parse.py | 2 +- libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_parse.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/addfunc_parse.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/addfunc_parse.py index 4f5ebc5a46a81..609814fe0e085 100755 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/addfunc_parse.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/addfunc_parse.py @@ -28,7 +28,7 @@ def is_pin(str): return False def parse_adc_table(fname, table): - csvt = csv.reader(open(fname,'rb')) + csvt = csv.reader(open(fname,'r')) i = 0 for row in csvt: for col in row: diff --git a/libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_parse.py b/libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_parse.py index d0edd0f57f8fb..f4dbab8fd5069 100755 --- a/libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_parse.py +++ b/libraries/AP_HAL_ChibiOS/hwdef/scripts/dma_parse.py @@ -11,7 +11,7 @@ def parse_dma_table(fname, table): dma_num = 1 - csvt = csv.reader(open(fname,'rb')) + csvt = csv.reader(open(fname,'r')) i = 0 last_channel = -1 for row in csvt: @@ -78,7 +78,7 @@ def check_full_table(table): sys.stdout.write('\t# format is (DMA_TABLE, StreamNum, Channel)\n') sys.stdout.write('\t# extracted from %s\n' % os.path.basename(sys.argv[1])) -for k in sorted(table.iterkeys()): +for k in sorted(table.keys()): s = '"%s"' % k sys.stdout.write('\t%-10s\t:\t[' % s) for i in range(len(table[k])):