aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-09-12 13:11:45 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2019-09-13 10:29:59 +0200
commit120a000e86e3adf2f8506c5ca958cff7a0ad16d0 (patch)
tree7d1faaedbf21c034c5be6cc76a38f971d0fec93e
parent1de89bf889bd9060f39efb41a14059dc87577e9f (diff)
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
-rwxr-xr-xpySim-prog.py4
1 files changed, 4 insertions, 0 deletions
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!")