Solution :
I think now you are having very strange issue which is related to raising a ValueError
exception inside the another caught exception. If you are looking for the quick fix for your error then you need to change below line of code
raise Exception('Invalid json: {}'.format(e))
To the below correct one.
raise Exception('Invalid json: {}'.format(e)) from None
It will make your end code as below:
with open(json_file) as jfile:
try:
json_config = json.load(jfile)
except ValueError as e:
raise Exception('Invalid json: {}'.format(e)) from None
After making above changes in your code you must get a desired result of catching the exception. Hope the solution helped you in quick fix.