diff --git a/src/wxflow/configuration.py b/src/wxflow/configuration.py index f06a3f3..3f9319b 100644 --- a/src/wxflow/configuration.py +++ b/src/wxflow/configuration.py @@ -172,7 +172,7 @@ def cast_as_dtype(string: str) -> Union[str, int, float, bool, Any]: if ',' in string: # Convert comma-separated list to python list - return [cast_as_dtype(elem.strip()) for elem in string.split(',')] + return [cast_as_dtype(elem.strip()) for elem in string.split(',') if elem.strip() != ''] def _cast_or_not(to_type: Any, string: str): try: diff --git a/tests/test_configuration.py b/tests/test_configuration.py index 1070226..077b00a 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -32,7 +32,7 @@ export SOME_BOOL6=.F. export SOME_LIST1="3, 15, -999" export SOME_LIST2="0.2,3.5,-9999." -export SOME_LIST3="20221225, 202212251845" +export SOME_LIST3="20221225, 202212251845," export SOME_LIST4="YES, .false., .T." export SOME_LIST5="0.2, test_str, 15, 20221225, NO" """