git.net

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

Is sys.executable not supposed to follow symlinks?


On Mon, Jul 27, 2020 at 8:04 AM Bolun Thompson <abolunthompson at gmail.com> wrote:
>
> In the sys.executable documentation (
> https://docs.python.org/3/library/sys.html#sys.executable), they don't
> specify if it follows symlinks. From my limited testing, it does not. Is
> this behavior guaranteed?

I don't know about guaranteed, but it's certainly the behaviour I
would expect. Recognizing the invocation executable is important to a
lot of commands that behave differently based on that, for instance
with the detection of a virtual environment. The fact that the
executable might be a symlink is irrelevant.

If you want to follow symlinks, you can always readlink on it.

ChrisA