Skip to content

Commit 5c6d3be

Browse files
authored
fix: handle case of str to bool env variable in config (#2966)
* fix: handle case of str to bool env variable in config * fix: add missing empty case * fix: PR feedback * not in
1 parent 635f6d5 commit 5c6d3be

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

awswrangler/_config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ def _apply_type(name: str, value: Any, dtype: type[_ConfigValueType], nullable:
224224
raise exceptions.InvalidArgumentValue(
225225
f"{name} configuration does not accept a null value. Please pass {dtype}."
226226
)
227+
# Handle case where string is empty, "False" or "0". Anything else is True
228+
if isinstance(value, str) and dtype is bool:
229+
return value.lower() not in ("false", "0", "")
227230
try:
228231
return dtype(value) if isinstance(value, dtype) is False else value
229232
except ValueError as ex:

0 commit comments

Comments
 (0)