[issue44264] Add descriptive error message when environment variable not detected

2022-01-29 Thread Irit Katriel
Irit Katriel added the comment: > os.environ defines the __delitem__ method to call C unsetenv(). Thus `del > os.environ[varname]` does unset the environment variable, at least at the > level of the C runtime. For the current process, yes. But it's not that what the user needs to do to fix

[issue44264] Add descriptive error message when environment variable not detected

2022-01-29 Thread Eryk Sun
Eryk Sun added the comment: This is just a point of clarification. > my del did not change the environment variable os.environ defines the __delitem__ method to call C unsetenv(). Thus `del os.environ[varname]` does unset the environment variable, at least at the level of the C runtime. --

[issue44264] Add descriptive error message when environment variable not detected

2022-01-29 Thread Irit Katriel
Irit Katriel added the comment: I vote to reject this proposal. Unless another core dev disagrees, I will close this issue. -- status: pending -> open ___ Python tracker ___

[issue44264] Add descriptive error message when environment variable not detected

2022-01-29 Thread Irit Katriel
Irit Katriel added the comment: > if a user of a Python program were to come across it, it may not indicate > what they needed to do to avoid the crash. The user of a program should not see this exception. The program should translate it to an error that would make sense to the user. -

[issue44264] Add descriptive error message when environment variable not detected

2022-01-29 Thread Irit Katriel
Irit Katriel added the comment: It's not necessarily true that the environment variable is not set just because the key is not in os.environ. In this example my del did not change the environment variable: >>> import os >>> os.environ['TMPDIR'] '/var/folders/kf/0v7kz3ps62dg11v9rq0sz35mgn

[issue44264] Add descriptive error message when environment variable not detected

2021-05-29 Thread David Gene
New submission from David Gene : Using os.environ[KEY] with a non-existent environment variable key only gives a simple KeyError, which may be fine for a developer to understand, but if a user of a Python program were to come across it, it may not indicate what they needed to do to avoid the