- if isCont:
- # continuation line
- result[curKey].append(shlex.split(line))
- else:
- # option line
- pos = line.index("=") # will raise exception when substring is not found
- curKey = line[:pos].strip()
- value = line[pos+1:]
- result[curKey] = shlex.split(value)
+ try:
+ if isCont:
+ # continuation line
+ result[curKey] += shlex.split(line)
+ else:
+ # option line
+ pos = line.index("=") # will raise exception when substring is not found
+ curKey = line[:pos].strip()
+ value = line[pos+1:]
+ result[curKey] = shlex.split(value)
+ except Exception:
+ raise Exception("Invalid config, line %d: Error parsing line (quoting issue?)" % linenr)