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

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Sat, 6 Feb 2021 13:05:01 UTC

Severity: normal

Found in version 27.1

To reply to this bug, email your comments to 46345 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#46345; Package emacs. (Sat, 06 Feb 2021 13:05:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Augusto Stoffel <arstoffel <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 06 Feb 2021 13:05:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Augusto Stoffel <arstoffel <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; Issue with `run-python' when `exec-path' is set buffer-locally
Date: Sat, 06 Feb 2021 12:18:10 +0100
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.




This bug report was last modified 4 years and 128 days ago.

Previous Next


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