blob: d7838a92ccba2e08f1e87d239f127f94bbb9510d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
"""
categories: Modules,os
description: ``getenv`` only allows one argument
cause: Unknown
workaround: Test that the return value is ``None``
"""
import os
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")
|