Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #378: Operators killed by year 2000 bug bite.


comp / comp.lang.python / Re: subprocess.Popen does not launch audacity

SubjectAuthor
o Re: subprocess.Popen does not launch audacityTim Johnson

1
Subject: Re: subprocess.Popen does not launch audacity
From: Tim Johnson
Newsgroups: comp.lang.python
Date: Fri, 10 Jan 2025 23:21 UTC
References: 1 2 3 4 5
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: thjmmj15@gmail.com (Tim Johnson)
Newsgroups: comp.lang.python
Subject: Re: subprocess.Popen does not launch audacity
Date: Fri, 10 Jan 2025 14:21:21 -0900
Lines: 61
Message-ID: <mailman.61.1736551287.2912.python-list@python.org>
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>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de DECUpk0XJCyNlggDbcly/w8C2t3aGQ7/iQbEQSqA0XAA==
Cancel-Lock: sha1:F/sWfCYGscwPC9eJOXe8S06Otc0= sha256:Q1xIJUJ2w7xBhf7GTY0wf0ZYQTScZu6XXm2omlLEgwI=
Return-Path: <thjmmj15@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=di/qHr1z;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.04; 'gui':
0.05; 'indicate': 0.05; 'app.': 0.07; 'skip:\xc2 30': 0.07;
'string': 0.07; 'etc.\xc2\xa0': 0.09; 'subject:not': 0.09;
'terminal': 0.09; 'unsure': 0.09; 'values.': 0.09; 'import': 0.15;
'>>>>': 0.16; 'flag': 0.16; 'insufficient': 0.16; 'pertinent':
0.16; 'pipe': 0.16; 'received:mail-pj1-x1033.google.com': 0.16;
'script.': 0.16; 'subject:does': 0.16; 'wrote:': 0.16; 'python':
0.16; 'message-id:@gmail.com': 0.18; 'code.': 0.19; 'pm,': 0.19;
'to:addr:python-list': 0.20; 'input': 0.21; 'application.': 0.22;
'maybe': 0.22; 'problem,': 0.22; 'command': 0.23; 'run': 0.23;
'code': 0.23; 'programming': 0.25; 'tim': 0.26; 'function': 0.27;
'>>>': 0.28; 'header:User-Agent:1': 0.30; "doesn't": 0.32;
'fine.': 0.32; 'guess': 0.32; 'python-list': 0.32; 'but': 0.32;
'received:192.168.1': 0.32; 'there': 0.33; 'path': 0.33; 'header
:In-Reply-To:1': 0.34; 'received:google.com': 0.34; 'printing':
0.34; 'from:addr:gmail.com': 0.34; 'files': 0.36; 'target': 0.36;
'using': 0.37; "it's": 0.37; 'could': 0.37; 'received:192.168':
0.37; 'list': 0.39; 'thanks': 0.39; 'adding': 0.39; 'prompt':
0.39; 'still': 0.40; 'want': 0.40; 'try': 0.40; 'should': 0.40;
'gave': 0.61; 'ten': 0.61; 'skip:\xc2 10': 0.62; 'great': 0.62;
'skip:r 20': 0.64; 'shows': 0.67; 'worked': 0.67; 'right': 0.68;
'launches': 0.69; 'below': 0.69; 'essential': 0.70; 'relevant':
0.73; 'causing': 0.75; '8bit%:100': 0.76; 'choice': 0.76; 'see,':
0.76; 'field': 0.78; '4:00': 0.84; 'eliminate': 0.84; 'redirect':
0.84; 'hidden': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1736551284; x=1737156084; darn=python.org;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:to:subject:user-agent:mime-version:date:message-id:from
:to:cc:subject:date:message-id:reply-to;
bh=4pHviwqX03XUDqfNKzA6vTrOv/h58AsidRVbeOgYnkc=;
b=di/qHr1zFYYk36xR0R4oodhWZG52GRb82zPm/65fwukxSYH3ca+65kJT8WJCxpqHQY
5THNBU9NeFcqyjHLOmgM/QMjqJXnX/KgyMa+8VxNXLJbRVGmrQevqbQrscQu4AxYRHt9
EJfzZ2S1M1eW4Nqkgo/XezH0VBPH8t3cv+EWnTvQN/MdbBZbA8+y4+5jEexIROqaW0Ol
rgd63x18Ha3Zl6ebSCm98oL1xaKK24Owav3x/YD8h2Hg8hBADfVfCNEo/H/TIS6myd9Y
OLMP4aCp+4gpOgJROwR5oLubG+MVGLLQe0tuaRy+Rgo1QVAWfGz6StB83JT/aqm85MMs
R56g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1736551284; x=1737156084;
h=content-transfer-encoding:in-reply-to:from:content-language
:references:to:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=4pHviwqX03XUDqfNKzA6vTrOv/h58AsidRVbeOgYnkc=;
b=OSBdErfjUYMvW1Cuv9Fvsga0wRE8+talgHz/E/cuJfItmg4gt5/wZOWQ1GYO8jWUcs
cDgO86NhA+KDK88YIF2d4T5x9QaIkB4f+8J5NV1DtXhaxATzXjAjwhdNCmAE99JQW7L7
1mAunPcuAsR8MY5JXThomO6KPDGuTM2ZLaClZ5+0U5Sl+1Khugam1k0mDL/qVzKz/oC4
/m2xwkaHVwzrRwz4SNk4LJ4MG6KC89sTCKHBqsSJvGEaOKC8U/labC8NOKhTWaM68MV3
I8yYcv7S20AZHco0a43EfH9nZZ5QbYjHydmzvWF4D48lECIY+2cx+BZYrM7rlt2TrDpc
te4A==
X-Gm-Message-State: AOJu0YxdoS5k2ZH/VWAmAC9vfdSDp3OAT2VOtJa6Ggu5NhP5/dqDvUq9
GKULjRrk8NNpMIt+ymFZvw+VYb2h5ZmFASJbwfZNaMJM4RxAP6r66nSAwQ==
X-Gm-Gg: ASbGncuIUoc7rjYM23PQEMPcMeHALq2h+r6ehAhy39iOm8SRJZH2c5G7dAcdH6QSvZ4
/h2op+8qP2xwc27aYdJAMHSKAZmIEajEnGgbxhgJNhJUG8gMoKJxRDHN+IJWgN0Z3Tmuw5+aal2
ivs5HO4A5eVFJmFxGTYWbPNWiKNVPvaZvqDNzaO9ujdBoMia6PdTG39mKn4q8Qmffu6r5bfa1wu
r633djAG4WWtoItK0zmbhQkT/Me0TzGl9NvofelxUIHqT4FO49a2OwlOOut6Av+FqpkoB33d6Bp
X-Google-Smtp-Source: AGHT+IG3d1bjJKKpT6270I+YZ+PF0aodVnDdL3VEiond+3pEuA8jO63Ex5/H1bcXagfUQ6HT9n9q3Q==
X-Received: by 2002:a17:90a:da88:b0:2ee:f80c:6889 with SMTP id
98e67ed59e1d1-2f548f3fdfbmr11757810a91.33.1736551283687;
Fri, 10 Jan 2025 15:21:23 -0800 (PST)
User-Agent: Mozilla Thunderbird
Content-Language: en-US
In-Reply-To: <5f5b9fdd-1680-470b-bd09-715e67f145bc@tompassin.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <f565be0c-ce6f-4e8f-953f-3739ca737f2f@gmail.com>
X-Mailman-Original-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>
View all headers

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.

>
>

1

rocksolid light 0.9.8
clearnet tor