GNU bug report logs - #46345
27.1; Issue with `run-python' when `exec-path' is set buffer-locally

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Augusto Stoffel <arstoffel@HIDDEN>; dated Sat, 6 Feb 2021 13:05:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 6 Feb 2021 13:04:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 06 08:04:41 2021
Received: from localhost ([127.0.0.1]:45429 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1l8NGS-0002JG-NP
	for submit <at> debbugs.gnu.org; Sat, 06 Feb 2021 08:04:41 -0500
Received: from lists.gnu.org ([209.51.188.17]:54446)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arstoffel@HIDDEN>) id 1l8LbV-0005gy-Eu
 for submit <at> debbugs.gnu.org; Sat, 06 Feb 2021 06:18:17 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:40432)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1l8LbV-0002xi-29
 for bug-gnu-emacs@HIDDEN; Sat, 06 Feb 2021 06:18:17 -0500
Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]:40094)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1l8LbT-00009r-Fv
 for bug-gnu-emacs@HIDDEN; Sat, 06 Feb 2021 06:18:16 -0500
Received: by mail-ej1-x632.google.com with SMTP id i8so16915062ejc.7
 for <bug-gnu-emacs@HIDDEN>; Sat, 06 Feb 2021 03:18:14 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=FfNI4+9AVwhd2AbWz2gMjVwTrE/RSBNSkxwZRu0X7Ok=;
 b=XMm3XoxcvTqghs+eX/aRgmWYVxTXrkQul4L6upC+I/PclvNg/dnlBEvGK9Nw+PpN2b
 zsZ0uj1qvMgyf/BxR0kQPqLJHDJ0LbDu3YhazUy5yY/BCznh2cFeLmamXDCmAcpfpEgh
 x5C7TAjU/TDQMN+CIXDbYKwICWO4AmQABdlCrayodaSbxJUjiHe7XIn/fwmeAxXumdQ5
 Cb3c53X6pkO7/VjIzTG7irna4VpYwMCx6oVM4F+bCMPTbSydHHVgBi8+k+z4fyIhO0r8
 H81VwJLltJ2lAUiZK985dJ2LvajEGb1zy5LGlQbS1VN7//5vymrHVCIS8kUmdk70f+SS
 Drzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=FfNI4+9AVwhd2AbWz2gMjVwTrE/RSBNSkxwZRu0X7Ok=;
 b=q/2YQjfdLLJY2h2IVs3JA7+viEAmC361KR2mtkkhGZoIfcdKjNmmalKawx3u1gvEDH
 PudRUfzK1XsMZDk3lMGB0FXGiEMvGTdqQd7D12SXUE909xIdHmXRQwB2IbUr3PwJha5t
 u/mCqD+6nBpd2cHXDBziQSUZGzg7Xs97f7FW9odujOIqJ0XBRVE0xXmBRgSJlKYNhcsD
 DObsU1RdY1S4cT+zzSpNWAoqdYDC2g+NnvtC9ANPQNcqc4ldPszzeSaODMNKscAwqHAS
 swC7PewTDe1oPVFesvX/AxLOAqVFcCfkfVpLunIQk34MNWfQLAopP/f3e+92AUJmPJka
 Gu9Q==
X-Gm-Message-State: AOAM533FWawxSBPs8V8BWpi9CltWafKGpoUFKjPcHoY077WebMKnJf+s
 OmSnEqx0uwBKtdneZwmVZJhdwia3hwU=
X-Google-Smtp-Source: ABdhPJwwGbiCUA6BFhk3MM2kHlwqASqxxtImIniRSVJJS4CugGjP1LFpkbyCenXzUg2AAEtgzpFXrw==
X-Received: by 2002:a17:906:1613:: with SMTP id
 m19mr8539925ejd.344.1612610292960; 
 Sat, 06 Feb 2021 03:18:12 -0800 (PST)
Received: from ars3 ([2a02:908:2211:8540::16e5])
 by smtp.gmail.com with ESMTPSA id i21sm5305891edy.9.2021.02.06.03.18.11
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 06 Feb 2021 03:18:12 -0800 (PST)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.1; Issue with `run-python' when `exec-path' is set buffer-locally
Date: Sat, 06 Feb 2021 12:18:10 +0100
Message-ID: <87r1ltv40d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:20::632;
 envelope-from=arstoffel@HIDDEN; helo=mail-ej1-x632.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sat, 06 Feb 2021 08:04:39 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

It is reasonable to set `exec-path' locally in Python buffers to reflect
a virtualenv, so that the external tools invoked by Eglot, Flycheck,
etc., work correctly.

This leads to two issues with `run-python'.  First, it doesn't inherit
the buffer-local `exec-path', which is probably the correct behavior.
Second, just having a buffer-local `exec-path' breaks the mechanism that
uses `python-shell-virtualenv-root' to find the Python interpreter.
`process-environment' is likely affected by similar issues.

On a related note: is there a good reason for
`python-shell-calculate-process-environment' not to update the PATH
entry?  It's not inconceivable that a Python script needs to call a
program which is only available in the virtualenv.  Moreover, from the
end-user perspective, it would be convenient if adding a call to

    (setq-local process-environment (python-shell-calculate-process-environment))

in some hook would make tools like `M-x compile' follow the
`python-shell-virtualenv-root' settings.




Acknowledgement sent to Augusto Stoffel <arstoffel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#46345; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 6 Feb 2021 13:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.