2020-02-02 16:33:09 -05:00
|
|
|
"""
|
|
|
|
categories: Modules,os
|
|
|
|
description: ``getenv`` only allows one argument
|
|
|
|
cause: Unknown
|
|
|
|
workaround: Test that the return value is ``None``
|
|
|
|
"""
|
|
|
|
import os
|
2020-03-22 22:26:08 -04:00
|
|
|
|
2020-02-02 16:33:09 -05:00
|
|
|
try:
|
|
|
|
print(os.getenv("NEW_VARIABLE", "DEFAULT"))
|
|
|
|
except TypeError:
|
|
|
|
print("should not get here")
|
|
|
|
# this assumes NEW_VARIABLE is never an empty variable
|
|
|
|
print(os.getenv("NEW_VARIABLE") or "DEFAULT")
|