Commit 4d2a5702 authored by amichaut's avatar amichaut
Browse files

improvement of load_dict to support badly formatted csv config file

parent 3d718867
......@@ -337,6 +337,10 @@ def load_dict(filename):
else:
try:
mydict[rows[0]] = eval(rows[1]) # if needs conversion
try:
mydict[rows[0]] = eval(eval(rows[1])) # if double string
except:
pass
except:
mydict[rows[0]] = rows[1] # if string
elif len(rows) > 2: # if line splitted because of comma, try to concatenate line
......@@ -344,11 +348,16 @@ def load_dict(filename):
for i in range(1,len(rows)-1):
val += rows[i]+','
val += rows[len(rows)-1]
if val == '':
mydict[rows[0]] = None
else:
try:
mydict[rows[0]] = eval(val) # if needs conversion
try:
mydict[rows[0]] = eval(eval(val)) # if double string
except:
pass
except:
mydict[rows[0]] = val # if string
return mydict
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment