Looks like python ast module literal_eval doesn't play well with f-strings in code.
Traceback (most recent call last):
File "/home/vagrant/venv/bin/pot-create", line 8, in <module>
sys.exit(main())
File "/home/vagrant/venv/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
return self.main(*args, **kwargs)
File "/home/vagrant/venv/lib/python3.8/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/vagrant/venv/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/vagrant/venv/lib/python3.8/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/home/vagrant/venv/lib/python3.8/site-packages/lingua/extract.py", line 426, in main
for message in extractor(real_filename, extractor_options):
File "/home/vagrant/venv/lib/python3.8/site-packages/lingua/extractors/python.py", line 415, in __call__
return parser(token_stream, options, filename, lineno)
File "/home/vagrant/venv/lib/python3.8/site-packages/lingua/extractors/python.py", line 188, in __call__
self.process_token(token_type, token, location, token_stream)
File "/home/vagrant/venv/lib/python3.8/site-packages/lingua/extractors/python.py", line 216, in process_token
self.handler(token_type, token, location, token_stream)
File "/home/vagrant/venv/lib/python3.8/site-packages/lingua/extractors/python.py", line 310, in state_in_keyword_call
token = safe_eval(token)
File "/home/vagrant/venv/lib/python3.8/site-packages/lingua/extractors/python.py", line 111, in safe_eval
return ast.literal_eval(s)
File "/usr/lib/python3.8/ast.py", line 99, in literal_eval
return _convert(node_or_string)
File "/usr/lib/python3.8/ast.py", line 98, in _convert
return _convert_signed_num(node)
File "/usr/lib/python3.8/ast.py", line 75, in _convert_signed_num
return _convert_num(node)
File "/usr/lib/python3.8/ast.py", line 66, in _convert_num
_raise_malformed_node(node)
File "/usr/lib/python3.8/ast.py", line 63, in _raise_malformed_node
raise ValueError(f'malformed node or string: {node!r}')
ValueError: malformed node or string: <_ast.JoinedStr object at 0x7ffb86797880>
Any workaround for this besides changing f-strings to format() syntax?
Hi,
Looks like python ast module
literal_eval
doesn't play well with f-strings in code.Any workaround for this besides changing f-strings to format() syntax?