The code runs a script using a subprocess and returns json. If I print the json, it comes back fine, but when I try to load it with json.loads, there is this error: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
output, err = p.communicate()
outstring = str(output)
print(output) # This works
return json.loads(outstring) # This has the error
Edit: I tried outstring.json() but got this error: AttributeError: 'str' object has no attribute 'json'
print(output)look like? From the error, it seems likeoutputis the empty string.print(repr(output))?