Inconsistent behavior with `env.list`
lucas-bremond opened this issue · comments
Lucas commented
When MY_ENV_VAR
is not defined,
env.int("MY_ENV_VAR", default=None)
returns None
(as expected), but:
env.list("MY_ENV_VAR", subcast=str, default=None)
yields the following Exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.10/site-packages/environs/__init__.py", line 122, in method
value = preprocess(value, **preprocess_kwargs)
File "/usr/local/lib/python3.10/site-packages/environs/__init__.py", line 206, in _preprocess_list
return typing.cast(str, value).split(delimiter) if value != "" else []
AttributeError: 'NoneType' object has no attribute 'split'
I believe the second example should return None
as well.
Thoughts?
Steven Loria commented
thanks for reporting this! this is fixed in #316