Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197155

Re: subprocess.Popen does not launch audacity

From Tim Johnson <thjmmj15@gmail.com>
Newsgroups comp.lang.python
Subject Re: subprocess.Popen does not launch audacity
Date 2025-01-10 14:21 -0900
Message-ID <mailman.61.1736551287.2912.python-list@python.org> (permalink)
References <735b7965-c16c-45a7-a2b8-d9ff1adc21ba@gmail.com> <616dcf1e-4f82-48ed-851c-fe5342f42f40@mrabarnett.plus.com> <d40046bc-57c7-436e-b9a2-49af00cc77d7@gmail.com> <5f5b9fdd-1680-470b-bd09-715e67f145bc@tompassin.net> <f565be0c-ce6f-4e8f-953f-3739ca737f2f@gmail.com>

Show all headers | View raw


On 1/10/25 12:53, Thomas Passin via Python-list wrote:
> On 1/10/2025 4:00 PM, Tim Johnson via Python-list wrote:
>>
>> On 1/10/25 11:32, MRAB via Python-list wrote:
>>>> ,,, snipped
>>
>>>> Below is the pertinent code:
>>>>
>>>>    Popen(choice, stdout=PIPE, stderr=PIPE,
>>>>                     stdin=PIPE, close_fds=True)
>>>>
>>>> My guess is my argument list is either insufficient or an argument is
>>>> causing the problem, but am unsure of which.
>>>>
>>>> I have been retired from python programming for ten years, and am 
>>>> pretty
>>>> rusty, but it is still fun. There are plenty
>>>>
>>>> of other ways to successfully launch audacity but it would be great to
>>>> make it work from this script.
>>>>
>>>
>>> What is the value of 'choice'?
>>>
>>> You could try printing out the value of 'choice' for one that works 
>>> and the one that doesn't and then try them again interactively from 
>>> the Python prompt with the given values. That should eliminate all 
>>> but the essential code for easier debugging.
>>
>> choice is /usr/local/bin/audacity, which is the correct path for 
>> audacity on my system. As far as I can see, that string has no hidden 
>> bytes.
>>
>> Invoking /usr/local/bin/audacity from the command line launches 
>> audacity and so does choosing  with dmenu_run. which -a audacity 
>> shows only that item.
>>
>> Maybe I need to isolate the function call and start stripping out 
>> parameters. I should have time to do that later today.
>
> I don't know why you would want to redirect stdin, etc.  It's a GUI 
> application.
>
> This worked for me in a Python session on EndeavourOS, python 3.13.1:
>
> >>> from subprocess import run
> >>> run('/usr/bin/audacity')

You're right as I suspected. The input files that I am using need a flag 
field to indicate whether the target

is a gui or terminal app. Removing the pipe parameters gave me audacity 
just fine. Time to roll up my sleeves

and get to work adding the relevant code. Beats shoveling snow. :)

Thanks everybody.

>
>

Back to comp.lang.python | Previous | Next | Find similar


Thread

Re: subprocess.Popen does not launch audacity Tim Johnson <thjmmj15@gmail.com> - 2025-01-10 14:21 -0900

csiph-web