bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#46345: 27.1; Issue with `run-python' when `exec-path' is set buffer-


From: Augusto Stoffel
Subject: bug#46345: 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]