Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
deeredman1991 opened this issue Nov 18, 2018 · 1 comment

Comments

@deeredman1991
Copy link

deeredman1991 commented Nov 18, 2018

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!

@deeredman1991 deeredman1991 changed the title Had error, fixed it myself, here is what I did. Had Error: "UnboundLocalError: local variable 'current_env' referenced before assignment" , fixed it myself, here is what I did. Nov 18, 2018
@deeredman1991 deeredman1991 changed the title Had Error: "UnboundLocalError: local variable 'current_env' referenced before assignment" , fixed it myself, here is what I did. Had Error: "UnboundLocalError: local variable 'current_env' referenced before assignment" at line 336 , fixed it myself, here is what I did. Nov 18, 2018
@deeredman1991 deeredman1991 changed the title Had Error: "UnboundLocalError: local variable 'current_env' referenced before assignment" at line 336 , fixed it myself, here is what I did. 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. Nov 18, 2018
@deeredman1991 deeredman1991 changed the title 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. 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. Nov 18, 2018
@cjrh
Copy link
Owner

cjrh commented Dec 1, 2018

@deeredman1991 good find! If you submit a pull request I will merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants