Open sebastic opened 3 years ago
ast.literal_eval()
does not support the alternative dict()
syntax:
>>> {}
{}
>>> dict()
{}
>>> ast.literal_eval('{}')
{}
>>> ast.literal_eval('dict()')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.9/ast.py", line 105, in literal_eval
return _convert(node_or_string)
File "/usr/lib/python3.9/ast.py", line 104, in _convert
return _convert_signed_num(node)
File "/usr/lib/python3.9/ast.py", line 78, in _convert_signed_num
return _convert_num(node)
File "/usr/lib/python3.9/ast.py", line 69, in _convert_num
_raise_malformed_node(node)
File "/usr/lib/python3.9/ast.py", line 66, in _raise_malformed_node
raise ValueError(f'malformed node or string: {node!r}')
ValueError: malformed node or string: <ast.Call object at 0x7fad4e8fd460>
Supporting both substitution variables and dictionary values may require changing the config file into a Jinja template.
Describe the bug stetl fails when using a configuration option with a dictionary value and an arguments dictionary.
Example config from: https://github.com/geopython/stetl/blob/master/examples/basics/11_formatconvert/etl.cfg#L46
To Reproduce
Expected Behavior The configuration is loaded successfully, including argument substitution.
Context (please complete one or more from the following information):
Additional context A
string2record
converter was implemented:Which requires configuration like this:
Due to this issue the converters which require
converter_args
cannot be used in the NLExtract BAGv2 configuration because that sets arguments viaoptions/<hostname>.args
.