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
Warn about invalid PYTHONUSERBASE #84384
Comments
https://docs.python.org/2/using/cmdline.html says that PYTHONUSERBASE defines the user base directory. If I understand this correctly, this implies that PYTHONUSERBASE should be a path a directory. I therefore think that python should print a warning if PYTHONUSERBASE is:
I think that export PYTHONUSERBASE="invalid//path" should generate a warning, because there is no good reason to do so. |
Forget the thing I said about "invalid//path", but my argument still stands for non existing paths or paths to something else than a directory. |
I marked this for 'interpreter Core' because it affects imports and nothing else seemed better. I marked this for 3.9 because it is too late to change 2.7. But I don't know whether PYTHONUSERBASE is still treated (or not treated) the same. Volker, I assume that you meant 'no good reason to not do so'. A possible reason is that checking the validity of all environmental variables at startup would slow down startup, whereas we have been trying to speed it up. Also, if PYTHONUSERBASE, in particular, is ever used for an import, a bad value will result in an import error. |
"there is no good reason to do so" meant that there is no good reason to set PYTHONUSERBASE to non existing path or a path that is not a directory. The history behind this bug report is that I used a program that, because of a bug in this program, set PYTHONUSERBASE to a non existing path, and I wondered why "import cython" raised a ModuleNotFoundError even though I had installed cython. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: