I’m trying to process the output of a command in python, but if I pass the numbers 1 or 2 in the parameters, then python perceives them as open pipes and gives an error. If pass 3, then no error occurs, an error occurs even if pass device_id = 0x01, etc.
Help solve the problem.
Expecting value: line 15 column 1 (char 298)
device_id = 1 # or 2
process = subprocess.run(
['command', '--json', '--device', '{}'.format(device_id)],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True
)
if process.stdout:
blblla
This is probably specific to the command you are trying to use, since the device_id that you supply is part of the arguments passed to the command. Please try to make sure that others can reproduce the problem, by following this advice: