"SyntaxError: invalid syntax" error on a line with a ternary conditional operator
Closed this issue · 2 comments
I have a Python source file (see attachment) that gives the following error when I try to convert it with f2format v0.4.3 on Ubuntu 18.04 64-bit using Python 3.6.5:
Traceback (most recent call last): File "/opt/design/python/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/opt/design/python/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar return list(map(*args)) File "/opt/design/python/lib/python3.6/site-packages/f2format/core.py", line 244, in f2format text = convert(string, lineno) File "/opt/design/python/lib/python3.6/site-packages/f2format/core.py", line 185, in convert val = ast.parse(temp_expr).body[0].value # parse AST File "/opt/design/python/lib/python3.6/ast.py", line 35, in parse return compile(source, filename, mode, PyCF_ONLY_AST) File "<unknown>", line 1 address:0{self.axi_address_width // 4 + (1 if self.axi_address_width % 4 != 0 else 0) ^ SyntaxError: invalid syntax
I suspect it because of the ternary conditional operator in that line of code.
xilinx.py.zip