Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Wrinkles should merely indicate where smiles have been. -- Mark Twain


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

SubjectAuthor
o Re: subprocess.Popen does not launch audacityLeft Right

1
Subject: Re: subprocess.Popen does not launch audacity
From: Left Right
Newsgroups: comp.lang.python
Date: Fri, 10 Jan 2025 21:39 UTC
References: 1 2 3 4
Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: olegsivokon@gmail.com (Left Right)
Newsgroups: comp.lang.python
Subject: Re: subprocess.Popen does not launch audacity
Date: Fri, 10 Jan 2025 22:39:35 +0100
Lines: 114
Message-ID: <mailman.59.1736545189.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>
<CAJQBtgnbOpkvHyLJtU0HtGhoYFA-Cw2X8jR1ReSGyNk+DM9ddQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de 5ERSRs3e/iknl9UEPsSIWA8zdjEhBdXbifO9SWaxpCvQ==
Cancel-Lock: sha1:6MX3ucHzDm66t2m877+q13aOMOg= sha256:J1jRdL1CTuIYhnUEcS3mJ7agJL0t4h/mmou0MiEu6g0=
Return-Path: <olegsivokon@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=hgzDSP3D;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'looks': 0.02; 'this:':
0.03; 'argument': 0.04; 'string': 0.07; 'url:mailman': 0.09;
'cc:addr:python-list': 0.09; 'grep': 0.09; 'subject:not': 0.09;
'terminal': 0.09; 'unsure': 0.09; 'values.': 0.09; 'cc:no real
name:2**0': 0.14; 'import': 0.15; 'url:listinfo': 0.15; '2025':
0.16; 'error?': 0.16; 'insufficient': 0.16; 'like.': 0.16; 'on.)':
0.16; 'pertinent': 0.16; 'proc': 0.16; 'proc.pid': 0.16;
'script.': 0.16; 'subject:does': 0.16; 'wrote:': 0.16; 'python':
0.16; 'cc:addr:python.org': 0.20; 'url-ip:188.166.95.178/32':
0.20; 'url-ip:188.166.95/24': 0.20; 'fri,': 0.22; 'maybe': 0.22;
'problem,': 0.22; 'returns': 0.22; 'command': 0.23; 'run': 0.23;
'code': 0.23; 'url-ip:188.166/16': 0.24; 'cc:2**0': 0.25;
'programming': 0.25; 'tried': 0.26; 'interface': 0.26; 'tim':
0.26; 'function': 0.27; '>>>': 0.28; 'message-id:@mail.gmail.com':
0.31; "doesn't": 0.32; '"",': 0.32; 'guess': 0.32; 'python-list':
0.32; 'but': 0.32; 'there': 0.33; 'path': 0.33; 'script': 0.33;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'printing': 0.34; 'from:addr:gmail.com': 0.34; 'processes': 0.36;
'work.': 0.37; 'could': 0.37; 'list': 0.39; 'thanks': 0.39;
'prompt': 0.39; 'still': 0.40; 'something': 0.40; 'try': 0.40;
'should': 0.40; '10,': 0.61; 'ten': 0.61; 'great': 0.62; 'your':
0.64; 'saw': 0.65; 'look': 0.65; 'shows': 0.67; 'and,': 0.69;
'launches': 0.69; 'skip:/ 10': 0.69; 'below': 0.69; 'above,':
0.70; 'essential': 0.70; 'waiting': 0.71; 'causing': 0.75;
'choice': 0.76; 'see,': 0.76; 'happens': 0.84; 'eliminate': 0.84;
'hidden': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1736545186; x=1737149986; darn=python.org;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=JgSNalIpDkyDDOWB/c5Iv9xmPJB0GDWZZG6nxsIOK/c=;
b=hgzDSP3D+xSl0WIYtnTy4rSOedlrpxT04tsTCX2jgm+YxB5TwEO2Vf1/XAdtLaBlF8
TADf9g8Bkk4NCFkYXv2CO670/wRO4bj6uri9sIbohrcuYEeFv5nKBiu0dHzZO4kVFjQY
Cb3zKV6B15jgMvkB99xF+K9oMsCuw7i28wWjRuF6sgesUuQGEPKs0BY+D4tXgf9SrJOh
UJ0bbW0hByogB0RBmqzsCDKOzXRj4Pgxx3pEt6KWMapX4Z727fG4/txn+hkhdaN2BhLF
yODIzJYnncklQ5hn108hDRjUTTMA4QQC93zGofeUej2up+MMaHt3UnEl01N8nQB4ohuL
OFpA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1736545186; x=1737149986;
h=content-transfer-encoding:cc:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=JgSNalIpDkyDDOWB/c5Iv9xmPJB0GDWZZG6nxsIOK/c=;
b=rvWZTJJXNZb8iDBeeagdNetBFkuPIIHEXk1DDvvMwuO1i5V4sCqq5XARDZMxuF3HlV
lSMhFTMWLQ/9Y1m0bmaHwiZUNpYjogpzan6NLCn6TD+Zykp7yQk09uwQn7ZWFzs4nGXK
lGbShPdpynRDfs1VRO9m3xhGaxnntA0+HdHvWNMQCkeekCDPs7oC7eDIMOvW6r8Chhsy
hsNMZL6TIe+EhqXepJvS+cV6sCcummcYIRzQuzgWMojl+MY8DhnODf08IJOzrsOgWK9W
gbs1keakgP0h/1BM/2Aapgq4N6qVO4iQOGZPR13N9Q7GN17WkppVG1Mx2RfIl3osPs4P
pfNg==
X-Gm-Message-State: AOJu0YwxKTFiG6Qbfk4t/hE0Zlez3wFV7wq3LwJOkf8rSmrBKrBBmRvZ
sw4sgxxkuBC3QHU/G+5l7uu9e5Knf55hsxwxURJXTDNwSWPuTo7NmrBqlFYsU2CNGitRza9d6qf
vHNYtAoX6ELuZKu1srxPPbHsp1sQ=
X-Gm-Gg: ASbGnctU5FBIbl+FNTRcC+FXCvm18yDxQzTAUw4z+8Zj22Ro/xp0OFSeUnQl6ylmb3N
i7J/bsR1xhiu3oALED1PwegR51hMQPlM7hii3zjbrSCxyPevL166TlmqoaKQrdSoeShNA
X-Google-Smtp-Source: AGHT+IERLnREL/ykMEy3odpuTsFWXIExwTqM9t5Kmv48E/gGp9v62z+QDEnApGe2LKbvcPsFCPKOuUXc0T+DMSu0ny8=
X-Received: by 2002:a05:6214:f2c:b0:6dd:d24:305c with SMTP id
6a1803df08f44-6df9b2b2c4fmr204557966d6.37.1736545186093; Fri, 10 Jan 2025
13:39:46 -0800 (PST)
In-Reply-To: <d40046bc-57c7-436e-b9a2-49af00cc77d7@gmail.com>
X-Gm-Features: AbW1kvbmRn7N4mx4v_CHSkbpzwdd9zLD7w4CqpYtFdR6UxVVWLngYhoukJyfJHc
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: <CAJQBtgnbOpkvHyLJtU0HtGhoYFA-Cw2X8jR1ReSGyNk+DM9ddQ@mail.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>
View all headers

I just tried this:

>>> import subprocess
>>> subprocess.run('which audacity', shell=True)
/usr/bin/audacity
CompletedProcess(args='which audacity', returncode=0)
>>> proc = subprocess.Popen('/usr/bin/audacity',
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE,
close_fds=True)
>>> proc.returncode
>>> proc.pid
53308
>>> proc.kill()
>>> proc.returncode
0
>>>

And I saw the interface of the program... So, in principle, what you
tried should work.

What happens if in a separate terminal you try:

$ ps auxwww | grep audacity?

Are there any processes running?

If your script fails, what is the error?

If it doesn't, can you run this:

$strace python ./audacity-test.py

where audacity-test.py looks like this:

import subprocess
proc = subprocess.Popen('/usr/local/bin/audacity',
stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE,
close_fds=True)
print(proc.returncode)
print(proc.pid)
proc.wait()
proc.kill()
print(proc.returncode)

Then, you should see something like:

clone(child_stack=NULL,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f377d83b750) = 53932
close(10) = 0
close(8) = 0
close(6) = 0
close(3) = 0
read(9, "", 50000) = 0
close(9) = 0
write(1, "None\n", 5None
) = 5
write(1, "53932\n", 653932
) = 6
wait4(53932,

(the process id you are waiting for is going to be different of
course, but the important part is that you find the clone() call that
returns the process id your code is waiting on.)

And, if it doesn't look like the above, then show what *does* it look like.

On Fri, Jan 10, 2025 at 10:03 PM Tim Johnson via Python-list
<python-list@python.org> 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.
>
> Thanks
>
> --
> https://mail.python.org/mailman/listinfo/python-list

1

rocksolid light 0.9.8
clearnet tor