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

David Gene report at bugs.python.org
Sat May 29 15:13:51 EDT 2021


New submission from David Gene <david at astrosticks.com>:

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 crash. I would raising the keyError with a message such as "Environment variable '{}' not set".

----------
messages: 394735
nosy: astrosticks
priority: normal
pull_requests: 25047
severity: normal
status: open
title: Add descriptive error message when environment variable not detected
type: enhancement
versions: Python 3.11

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44264>
_______________________________________


More information about the Python-bugs-list mailing list