Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-12 Thread Chris Angelico
On Sat, 13 May 2023 at 07:21, Horst Koiner wrote: > > Using asyncio for this is a good possibility I was not aware of. > > My best try with asyncio was: > import asyncio > > async def run_command(): > # Create subprocess > process = await asyncio.create_subprocess_exec( > './test.s

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-12 Thread Horst Koiner
Using asyncio for this is a good possibility I was not aware of. My best try with asyncio was: import asyncio async def run_command(): # Create subprocess process = await asyncio.create_subprocess_exec( './test.sh', stdout=asyncio.subprocess.PIPE, # Redirect stdout to a p

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-10 Thread Mats Wichmann
On 5/10/23 12:51, Dieter Maurer wrote: Horst Koiner wrote at 2023-5-9 11:13 -0700: ... For production i run the program with stdout=subprocess.PIPE and i can fetch than the output later. For just testing if the program works, i run with stdout=subprocess.STDOUT and I see all program output on

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-10 Thread Dieter Maurer
Horst Koiner wrote at 2023-5-9 11:13 -0700: > ... >For production i run the program with stdout=subprocess.PIPE and i can fetch >than the output later. For just testing if the program works, i run with >stdout=subprocess.STDOUT and I see all program output on the console, but my >program afterwa

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread Eryk Sun
On 5/9/23, Thomas Passin wrote: > > I'm not sure if this exactly fits your situation, but if you use > subprocess with pipes, you can often get a deadlock because the stdout > (or stderr, I suppose) pipe has a small capacity and fills up quickly > (at least on Windows), The pipe size is relativel

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread jak
Horst Koiner ha scritto: Hi @all, i'm running a program which is still in development with subprocess.run (Python version 3.10), further i need to capture the output of the program in a python variable. The program itself runs about 2 minutes, but it can also freeze in case of new bugs. For p

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread Thomas Passin
On 5/9/2023 2:13 PM, Horst Koiner wrote: Hi @all, i'm running a program which is still in development with subprocess.run (Python version 3.10), further i need to capture the output of the program in a python variable. The program itself runs about 2 minutes, but it can also freeze in case of

Re: Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread Mats Wichmann
On 5/9/23 12:13, Horst Koiner wrote: Hi @all, i'm running a program which is still in development with subprocess.run (Python version 3.10), further i need to capture the output of the program in a python variable. The program itself runs about 2 minutes, but it can also freeze in case of new

Do subprocess.PIPE and subprocess.STDOUT sametime

2023-05-09 Thread Horst Koiner
Hi @all, i'm running a program which is still in development with subprocess.run (Python version 3.10), further i need to capture the output of the program in a python variable. The program itself runs about 2 minutes, but it can also freeze in case of new bugs. For production i run the program