I have a json settings file that contains the settings for my script. Part of the settings is the delimiter for the csv.writer()
.
When it is being read into the variable settings
and printed it giving me this: {'delimiter': u','}
When I try use this in the csv.writer(out, **settings)
I get the following error: TypeError: "delimiter" must be an 1-character string
.
Now to fix this I do do this: settings["delimiter"] = settings["delimiter"].encode("utf-8")
...but I am wondering if there is a way I can read this file in the first place which would mean I didn't have do to this?
EDIT:
Settings file is read like this:
with open(file) as settings:
details = json.load(settings)