Python: raise KeyError(key) from None

This:

will generate:

if the environment variable does not exist.

 

Instead use:

testing = os.environ.get('testing', 'False')

which lets you set a default.

 

Leave a Reply

Your email address will not be published. Required fields are marked *