Skip to content

break in detect_active_interpreter prevents fallback detectors #547

@gaborbernat

Description

@gaborbernat

In _detect_env.py:29-30, if the first detector returns a path that doesn't exist, break aborts the entire loop — conda and poetry detectors never get a chance to run:

for detect in detection_funcs:
    path = detect()
    if not path:
        continue
    if not path.exists():
        break          # <-- should be continue
    return str(path)

For example, if VIRTUAL_ENV points to a stale/removed directory, the user gets SystemExit even if CONDA_PREFIX is set to a valid environment.

Fix: change break to continue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions