From 00299e3df3c05257e11199abc1514b9932534efd Mon Sep 17 00:00:00 2001 From: Cort Buffington Date: Fri, 12 Oct 2018 22:51:16 -0500 Subject: [PATCH] ignore rows in the wrong format Becuse we can't goddam go longer than a few weeks without someone having to chnage the format of the ID files. --- dmr_utils/utils.py | 10 ++++++++-- setup.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/dmr_utils/utils.py b/dmr_utils/utils.py index c8369c7..d2e47fd 100755 --- a/dmr_utils/utils.py +++ b/dmr_utils/utils.py @@ -104,7 +104,10 @@ def mk_id_dict(_path, _file): with open(_path+_file, 'rU') as _handle: ids = csv_reader(_handle, dialect='excel', delimiter=',') for row in ids: - dict[int(row[0])] = (row[1]) + try: + dict[int(row[0])] = (row[1]) + except: + pass _handle.close return dict except IOError: @@ -125,7 +128,10 @@ def mk_full_id_dict(_path, _file, _type): ids = csv_dict_reader(_handle, fieldnames=fields, restkey='OTHER', dialect='excel', delimiter=',') for row in ids: for item in row: - dict[int(row['ID'])] = row + try: + dict[int(row['ID'])] = row + except: + pass _handle.close return dict except IOError: diff --git a/setup.py b/setup.py index db1394f..34fd7c8 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ def readme(): return file.read() setup(name='dmr_utils', - version='0.1.15', + version='0.1.16', description='ETSI DMR (Digital Mobile Radio) Tier II Utilities', long_description='Modules to disassemble and assemble DMR packets, including generating and decoding various FEC routines', classifiers=[