-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Invalid values in boolean options in the environment cause traceback #5616
Comments
Definitely a place where we can print a better error message. :) |
This issue is a good starting point for anyone who wants to help out with pip's development -- it's simple and the process of fixing this should be a good introduction to pip's development workflow. See the discussion above to understand what the desired fix is. Feel free to mention me (write @pradyunsg in the comment) if you need help. :) |
@pradyunsg can I take this up? |
Sure. :) |
@sinscary How's it going? Did you get some time to look into this? |
@pradyunsg Sorry, actually I was kinda busy. Will try to finish it by today. |
@pradyunsg what will be an appropriate error message in this case. What I can think of is - |
Yeah. And then have it use the default value that it would. store_true's default is False, counts default is 0 and so on. |
@pradyunsg So shouldn't it be exiting the process if |
Yeah... That's what I was suggesting. Actually what you're suggesting also makes sense; pip should error out if the configuration provided to it is incorrect. |
1 similar comment
Yeah... That's what I was suggesting. Actually what you're suggesting also makes sense; pip should error out if the configuration provided to it is incorrect. |
I think if pip doesn't error out, it might be confusing for many users(beginners mostly) as they won't be getting the desired behavior as per the configuration they have provided. So I think it will be better to exit the process with an error message rather than setting the default values. what say? Anyways I am almost done and will raise a PR soon. 😄 |
I agree, I'd error out if the user gives an incorrect value. |
Erroring out sounds good to me too. :) |
This catches code exception if wrong arguments passed to cmd options It also adds error message that suggests correct arguments to pass Fixes: pypa#5616
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Environment
Description
When setting an environment variable that is supposed to hold a boolean value to an invalid string that is not empty, a traceback happens.
Expected behavior
An error message along the lines of "'blah' is not a valid value for ..., valid values
How to Reproduce
pip install pip==10.0.1
env PIP_REQUIRE_VIRTUALENV='blah' PYTHONPATH=src python -m pip install twisted
Output
Note
The documentation of
strtobool
(seen in the traceback above) says:"True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0. Raises ValueError if val is anything else."
The text was updated successfully, but these errors were encountered: