Page 1 of 1

How to use sys.stdout and stdout.pipe in subprocess.run

Posted: Thu Oct 13, 2022 7:17 pm
by Shanmugam
Hi,
I want to print the external commands and output both in real-time and in logs,
I am using the below

Code: Select all

p=subprocess.run("powershell.exe",c:\temp\hello.ps1",stdout=sp.PIPE,stderr =stdout)


I want to use sys.stdout along with sys.stdout to do in real-time,
Please advise

Thanks
Shanmugam