Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

Had Error: "UnboundLocalError: local variable 'current_env' referenced before assignment" at line 336 in conda_change_env, fixed it myself, here is what I did. #28

@deeredman1991

Description

@deeredman1991

So vim was throwing me this error;

condavimbugfixed

You can reproduce it using the following steps:
1). Switch to any other conda environment,
2). Switch back to the original "Anaconda3" environment and finally;
3). Attempt to switch to any other environment.

I just added the following code around line 330ish:

    default_prefix = get_default_prefix()
  
    # my addition:
    current_env = root_prefix

    for key, value in envnames.items():
        if value == default_prefix:
            current_env = key
            break

and it fixed the issue.

I am just popping in to give you a heads up. Great plugin by the way!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions