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

"pyenv version" with invalid versions should not fail #291

Closed
blueyed opened this issue Dec 11, 2014 · 1 comment
Closed

"pyenv version" with invalid versions should not fail #291

blueyed opened this issue Dec 11, 2014 · 1 comment

Comments

@blueyed
Copy link
Contributor

blueyed commented Dec 11, 2014

% cat .pyenv/version
3.4.2
2.7.9rc1
2.7.8

% pyenv version
pyenv: version `2.7.9rc1' is not installed
pyenv-virtualenvwrapper: python is not available.
pyenv-virtualenvwrapper: failed to initialize virtualenvwrapper_lazy.
pyenv: version `2.7.9rc1' is not installed

I would like it to display the other versions, too.

@yyuu
Copy link
Contributor

yyuu commented Dec 14, 2014

Thanks for good PR including tests 👍 Although, I don't think permissive approach is always good to deal with configuration errors.

When pyenv-version-name was invoked, there should be 3 cases.

  1. All versions in pyenv-version-origin are available
  2. Some versions in pyenv-version-origin are available
  3. All versions in pyenv-version-origin are unavailable

In case 1 and 3, it's clear what to do. In case 2, pyenv v20141211 displays errors on standard error then exists with 1. This must be the most conservative behaviour.

OTOH, with this patch, it displays all available versions, then exits with 1 only if none is available. This is permissive behaviour than current v20141211.

I think being conservative is good enough since it indicates that there is some errors. The version in .python-version might be invalid to local pyenv installation since it might be managed by other users if the file is committed into the application repository. I think that the problem is in some of code in pyenv-virtualenv and pyenv-virtualenvwrapper which handles output from pyenv-version-name. They should be able to handle the errors from pyenv-version-name properly.

yyuu added a commit to pyenv/pyenv-virtualenv that referenced this issue Dec 14, 2014
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