Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Fundamentally, there may be no basis for anything.


devel / comp.lang.python / Re: Running a subprocess in a venv

SubjectAuthor
o Re: Running a subprocess in a venvMats Wichmann

1
Re: Running a subprocess in a venv

<mailman.26.1697915294.3828.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=28578&group=comp.lang.python#28578

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: mats@wichmann.us (Mats Wichmann)
Newsgroups: comp.lang.python
Subject: Re: Running a subprocess in a venv
Date: Sat, 21 Oct 2023 13:08:03 -0600
Lines: 24
Message-ID: <mailman.26.1697915294.3828.python-list@python.org>
References: <CACwCsY44DNAJDZbD20bfycRQ6yr5LK1bR_RLw_x+Z2qfqP-ayA@mail.gmail.com>
<41383972-db38-4f2d-87aa-875b315a6681@wichmann.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de de4F9B0+sBj0orMAvxXwaQoxSNYhnauHKTuyD/5Dv3TA==
Cancel-Lock: sha1:K+Q7Ql6hbYwJhRnce5NYl6A/7RE= sha256:PT3nwiXN8E4N0q/2E210Ud+G2Wlrw1tSdSkIF3GruLM=
Return-Path: <mats@wichmann.us>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=pobox.com header.i=@pobox.com header.b=oBEohjtf;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.034
X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'that?': 0.07; 'skip:_ 20':
0.09; 'way?': 0.09; 'elsewhere,': 0.16; 'paths': 0.16; 'pip,':
0.16; 'received:64.147': 0.16; 'script,': 0.16; 'virtualenv':
0.16; 'wrote:': 0.16; 'python': 0.16; 'to:addr:python-list': 0.20;
'creates': 0.22; 'installed': 0.23; 'run': 0.23; 'seems': 0.26;
'header:User-Agent:1': 0.30; 'python-list': 0.32; 'but': 0.32;
'there': 0.33; 'path': 0.33; 'script': 0.33; 'package': 0.34;
'header:In-Reply-To:1': 0.34; 'fine': 0.35; 'runs': 0.35;
'really': 0.37; 'directory': 0.37; 'received:192.168': 0.37;
'file': 0.38; 'way': 0.38; 'could': 0.38; 'necessary': 0.39;
'mentioned': 0.39; 'use': 0.39; 'want': 0.40; 'best': 0.61;
'search': 0.61; 'your': 0.64; 'received:64': 0.67; 'export': 0.69;
'deal': 0.73; 'activation': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id
:date:mime-version:subject:to:references:from:in-reply-to
:content-type:content-transfer-encoding; s=sasl; bh=59hSF2D0YSb2
LL8hOdAhzOUtygFb+7V10lT6hsgkC+g=; b=oBEohjtfow8yex0F6ZfvFVehysww
rQuvAkniJ/hNA2mkW0R8sFSlJ1IFV/c/t8Xm715RoWKSrU5nBVIBgFnwVHon/vfG
EkCwUBsFbRxqzfG93n9AAvILANhko8hBJ12VDg3Nn4RFkTAB1kh16C3x8vYp8c8e
MM85JKb1AtkbNVM=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=wichmann.us;
h=message-id:date:mime-version:subject:to:references:from:in-reply-to:content-type:content-transfer-encoding;
s=2018-07.pbsmtp; bh=59hSF2D0YSb2LL8hOdAhzOUtygFb+7V10lT6hsgkC+g=;
b=BSw4Myp0SPDhvY08HLOxX0fJoQLNmi6O5XV1XOYS9+ra1lbv8xA/Teavt1pXtPsAoQbh4Y4lTInNL2p3S9xdkW+FwakkkglJAb0AEe6Tl1QfaaxCZO8GjMuH0OS/pWTwlHdGBbx/eqwxk299twRLYtF/HBdpPWiiYqLyHR2Wy6s=
User-Agent: Mozilla Thunderbird
Content-Language: en-US
Autocrypt: addr=mats@wichmann.us; keydata=
xsDiBD9xp6oRBAC1v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30zksB
36NnhZWPRWIhjK3ZarIYH8JGBBgRAgAGBQI/mKzwAAoJEMAxoJBz2FTG6VEAoKDYHfDp5Q3q
PuPvPahCE9HsXMgAAJ9INTqcLSJrOfyJ8q95nBO1T26H2Q==
In-Reply-To: <CACwCsY44DNAJDZbD20bfycRQ6yr5LK1bR_RLw_x+Z2qfqP-ayA@mail.gmail.com>
X-Pobox-Relay-ID: 2989EBAC-7045-11EE-A01B-25B3960A682E-81526775!pb-smtp2.pobox.com
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: <41383972-db38-4f2d-87aa-875b315a6681@wichmann.us>
X-Mailman-Original-References: <CACwCsY44DNAJDZbD20bfycRQ6yr5LK1bR_RLw_x+Z2qfqP-ayA@mail.gmail.com>
 by: Mats Wichmann - Sat, 21 Oct 2023 19:08 UTC

On 10/21/23 07:01, Larry Martell via Python-list wrote:
> I have a python script, and from that I want to run another script in
> a subprocess in a venv. What is the best way to do that? I could write
> a file that activates the venv then runs the script, then run that
> file, but that seems messy. Is there a better way?

You don't need to "activate" a virtualenv. The activation script does
some helpful things along the way (setup and cleanup) but none of them
are required. The most important thing it does is basically:

VIRTUAL_ENV='path-where-you-put-the-virtualenv'
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/bin:$PATH"
export PATH

and that's really only so that commands that belong to that virtualenv
(python, pip, and things where you installed a package in the venv wich
creates an "executable" in bin/) are in a directory first in your search
path. As long as you deal with necessary paths yourself, you're fine
without activating. So as mentioned elsewhere, just use the path to the
virtualenv's Python and you're good to go.


devel / comp.lang.python / Re: Running a subprocess in a venv

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor