Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"A mind is a terrible thing to have leaking out your ears." -- The League of Sadistic Telepaths


devel / comp.lang.python / Re: venv and executing other python programs

SubjectAuthor
o Re: venv and executing other python programsMartin Di Paola

1
Re: venv and executing other python programs

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: martinp....@gmail.com (Martin Di Paola)
Newsgroups: comp.lang.python
Subject: Re: venv and executing other python programs
Date: Wed, 16 Feb 2022 02:18:58 +0000
Lines: 53
Message-ID: <mailman.131.1644977946.7010.python-list@python.org>
References: <620B3B96.7080309@googlemail.com>
<20220215123653.5u4zpwrelyd2fela@gmail.com>
<B8FFB248-9EFB-42E6-B4AD-B4096FB9F1F6@barrys-emacs.org>
<20220216021858.wcxg5uztdre5dysr@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de svQBjbCCkkslrk2iPN0XCQCoCGp/Qjx9VUARlHbmupPw==
Return-Path: <martinp.dipaola@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=R07X0oDF;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '2022': 0.05; 'run.': 0.05;
'subject:python': 0.06; ';-)': 0.07; 'explicitly': 0.07;
'modules': 0.07; 'that?': 0.07; 'python"': 0.09; 'url:mailman':
0.15; 'problem.': 0.15; 'executable': 0.16; 'executables': 0.16;
'folder.': 0.16; 'modifies': 0.16; 'right.': 0.16; 'variant':
0.16; 'wrote:': 0.16; 'python': 0.16; 'feb': 0.17; 'message-
id:@gmail.com': 0.18; 'uses': 0.19; "aren't": 0.19; 'libraries':
0.19; 'tue,': 0.19; 'to:addr:python-list': 0.20; 'install': 0.23;
'code': 0.23; 'installed': 0.23; 'url-ip:188.166.95.178/32': 0.25;
'url-ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'url-
ip:188.166/16': 0.25; 'tried': 0.26; 'else': 0.27; '>>>': 0.28;
'recently': 0.29; 'it,': 0.29; 'url-ip:188/8': 0.31; 'program':
0.31; 'context': 0.32; 'python-list': 0.32; 'but': 0.32; "i'm":
0.33; 'there': 0.33; 'particular': 0.33; 'script': 0.33; 'same':
0.34; "didn't": 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'from:addr:gmail.com': 0.35;
'thanks,': 0.36; 'people': 0.36; 'using': 0.37; "it's": 0.37;
'received:209.85': 0.37; 'thanks': 0.38; 'received:209': 0.39;
'use': 0.39; 'something': 0.40; 'skip:h 10': 0.61; 'here': 0.62;
'your': 0.64; 'time.': 0.66; 'interested': 0.68; 'discussing':
0.69; 'subject:other': 0.69; 'analysis': 0.69; 'note:': 0.71;
'deal': 0.73; 'points': 0.84; 'martin.': 0.84; 'activate': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=date:from:to:subject:message-id:mail-followup-to:'user-agent
:references:mime-version:content-disposition:in-reply-to;
bh=5i2e2H1SwucJuEVUw2lMLPj76L48cHVdkcGBPUBudRc=;
b=R07X0oDF0pJ3KRe3JIKCNPjqqeh4/ppoguu3bEq1SfzI44hFV3aBvajM0GdqKCtjEG
fZUfMKGCgpbZxTRwSqxTcy9G9w8MWR9G/3MuJsMLf2r/FqLLuyyKUBGXD/XliCwtCXGm
tz+rCZwOdvDNbamWfZX/8CIu66mDfJteqHq9T0yUwZkZnoJ7fUGRmhe581HaRFnnsalv
uGcOeVH+wOntdjeoZBmEUdMwptBj8velQFMkqplrilnbRfxQwlhUXQLOGHLFVcoFEqwR
OzUFyJ3IL9lsrI+n0S4BO144i3cRCwFQUsVCD341M9aCQWD9bSNX3XKE1Na0UHsSkoJ+
VIJw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to
:'user-agent:references:mime-version:content-disposition:in-reply-to;
bh=5i2e2H1SwucJuEVUw2lMLPj76L48cHVdkcGBPUBudRc=;
b=WD7JdOp24d0KSJxZFCZfpp6skEYkU8Meyzz2bFh02FYra1UHnHuLOHb7+3HQ07MYSk
xMbcIm7yMU0EU27TvNgLtOYYRBO3DDvU1VfbJzbuZJZl8pwnX7dF7iG0Tt79a5DC5NGZ
XIN4AaG7D2Qrs/xJx80piDLNG5KPMnMr9JO8IkmFKPvLDbP9j/BeXjbKdUVE/o9dvInw
OxBQUS3Y3SFm+c/kbRLbZHrlisV570hKGNoL1DZsbT+6yuFy90rLQ3aPLxqR2T6ESdf/
aTvl8DVNHJd+gsAxQKFf21DyiIVoAO6GZa0IfjyCTgbeNVS2OnhnJ80Gke8HC8/dFOeJ
gfLA==
X-Gm-Message-State: AOAM533IbSCsX7/gd1GwoUVnCvgO/WiJO8kr+LuyL4JUT1gH0wEgBRKl
YtwyCRS1aDVdb6vWhg8BObNeaMEit47row==
X-Google-Smtp-Source: ABdhPJyjEPYS4UgL42WD7yxrZwoGl+VOq01yPeT+tFM3z7ewlp+wbnU0RJZ7Oagcy64M1xo+tv/bfg==
X-Received: by 2002:a05:6808:1443:b0:2cd:9b82:cd5c with SMTP id
x3-20020a056808144300b002cd9b82cd5cmr3015169oiv.27.1644977943533;
Tue, 15 Feb 2022 18:19:03 -0800 (PST)
Mail-Followup-To: Python List <python-list@python.org>
'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.5.2 Lightning/5.4.5.2'
Content-Disposition: inline
In-Reply-To: <B8FFB248-9EFB-42E6-B4AD-B4096FB9F1F6@barrys-emacs.org>
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: <20220216021858.wcxg5uztdre5dysr@gmail.com>
X-Mailman-Original-References: <620B3B96.7080309@googlemail.com>
<20220215123653.5u4zpwrelyd2fela@gmail.com>
<B8FFB248-9EFB-42E6-B4AD-B4096FB9F1F6@barrys-emacs.org>
 by: Martin Di Paola - Wed, 16 Feb 2022 02:18 UTC

>If you have activated the venv then any script that uses /usr/bin/env
>will use executables from the venv
>bin folder.

That's correct. I tried to be systematic in the analysis so I tested all
the possibilities.

>I avoid all these issues by not activating the venv. Python has code to
>know
>how to use the venv libraries that are installed in it when invoked. It does not
>depend on the activate script being run.

I had to test this myself because I didn't believe it but you are right.
Without having the venv activated, if the shebang explicitly points to
the python executable of the venv, the program will have access to the
libs installed in the environment.

The same if I do:

/home/user/venv/bin/python foo.py

Thanks for the info!
>
>Barry
>
>
>>
>> Do you have a particular context where you are having troubles? May be there is something else going on...
>>
>> Thanks,
>> Martin.
>>
>> On Tue, Feb 15, 2022 at 06:35:18AM +0100, Mirko via Python-list wrote:
>>> Hi,
>>>
>>> I have recently started using venv for my hobby-programming. There
>>> is an annoying problem. Since venv modifies $PATH, python programs
>>> that use the "#!/usr/bin/env python" variant of the hashbang often
>>> fail since their additional modules aren't install inside in venv.
>>>
>>> How to people here deal with that?
>>>
>>> Please note: I'm not interested in discussing whether the
>>> env-variant is good or bad. ;-) It's not that *I* use it, but
>>> several progs in /usr/bin/.
>>>
>>> Thanks for your time.
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor