From 120a000e86e3adf2f8506c5ca958cff7a0ad16d0 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Thu, 12 Sep 2019 13:11:45 +0200 Subject: pySim-prog: use case insensitive CSV headers. Inside of pySim all CSV headers are defined in lower case and are evaluated case sensitive. This means that a CSV file that contains the headers in uppercase for example will not parse. Lets make sure that the CSV headers are evaluated case insensitive to increase compatibility with slightly different formats. Change-Id: I1a476e7fc521d1aad2956feec3db196156961d20 --- pySim-prog.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pySim-prog.py b/pySim-prog.py index 2387986..e92654d 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -456,6 +456,10 @@ def _read_params_csv(opts, iccid=None, imsi=None): import csv f = open(opts.read_csv, 'r') cr = csv.DictReader(f) + + # Lower-case fieldnames + cr.fieldnames = [ field.lower() for field in cr.fieldnames ] + i = 0 if not 'iccid' in cr.fieldnames: raise Exception("CSV file in wrong format!") -- cgit v1.2.3