This forum is full of similar questions, so here is mine:

import re 
import subprocess 
rx = re.compile("(?m)^(cpu)(.*)") 
output = subprocess.run(["cat","/proc/cpuinfo"], stdout=subprocess.PIPE) 
lines = output.stdout.decode('utf-8') 
r = rx.search(lines) 
if r: 
  print(r.groups()) 

I expect this snipped to find some cpu in the multi-line file, but nothing is shown.
(The actual code that fails for me looks of course different, but this is the simplest test case that fails for me, and I can not figure out why…)

2