I just had a similar problem trying to call a confined app from a classic one in Python:
subprocess.run("command", stdin=open("/file/path", "rb"))
The way around it is either reading the file into memory and feeding it in:
subprocess.run("command", input=open("/file/path", "rb").read())
Or looping over the file and writing to the process's stdin:
with subprocess.Popen("command", stdin=subprocess.PIPE) as p, \ open("/file/path", "rb") as f: while True: buf = f.read(8192) if buf: p.stdin.write(buf) else: break
I just had a similar problem trying to call a confined app from a classic one in Python:
subprocess. run("command" , stdin=open( "/file/ path", "rb"))
The way around it is either reading the file into memory and feeding it in:
subprocess. run("command" , input=open( "/file/ path", "rb").read())
Or looping over the file and writing to the process's stdin:
with subprocess. Popen(" command" , stdin=subproces s.PIPE) as p, \ "/file/ path", "rb") as f:
p. stdin.write( buf)
open(
while True:
buf = f.read(8192)
if buf:
else:
break