Subprocess.run interprets the digits 1 and 2 as pipe

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
python --version
Python 3.11.4

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:

Thnaks. That’s my fault.
The error was in the program json output because of an extra comma after the array.

Just a short unrelated note, this:

 '{}'.format(device_id)

is an elaborate way to write:

 str(device_id)

Of course, in other circumstances you might have a case for a format
string. But here it looks a bit roundabout to my eye.

Cheers,
Cameron Simpson cs@cskk.id.au