Json decode issue

Hi,
I ran the below script it works but sometimes it is giving me the below error.
could any pls help me for resolving the issue.
scipt:
path=’/opt/git/apim-rt-cc3/SplitOrgsMP/methods’
subprocess.Popen([‘terraform -chdir=’+path+’ show -json > ‘+path+’"/output.json"’],stdout=subprocess.PIPE, shell=True)
mpIps =
f = open(path+’/output.json’)
data = json.load(f)
ip=(data[‘values’][‘outputs’][‘address’][‘value’])
ip1=ip.split(’,’)
print(ip1)

Error:

]$ python3 test.py
Traceback (most recent call last):
File “test.py”, line 18, in
data = json.load(f)
File “/usr/lib64/python3.6/json/init.py”, line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File “/usr/lib64/python3.6/json/init.py”, line 354, in loads
return _default_decoder.decode(s)
File “/usr/lib64/python3.6/json/decoder.py”, line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File “/usr/lib64/python3.6/json/decoder.py”, line 357, in raw_decode
raise JSONDecodeError(“Expecting value”, s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

It means the JSON is invalid. It must be UTF-8 encoded and a file in this encoding cannot start with a null character.