AttributeError: 'Name' object has no attribute 'value'
Closed this issue · 3 comments
tina-junold commented
Hi,
I'm try to generate the classes (2020, 2021) for php, but i always get the same issue:
lstgen -p 2021_1 -l php --class-name Lohnsteuer2021 --outfile Lohnsteuer2021.php
/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py:979: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.bmf-steuerrechner.de'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
warnings.warn(
Traceback (most recent call last):
File "/usr/local/bin/lstgen", line 33, in <module>
sys.exit(load_entry_point('LstGen==0.5.2', 'console_scripts', 'lstgen')())
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/cli.py", line 175, in main
generator.generate()
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 112, in generate
self._write_method(method)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 166, in _write_method
self._write_stmt_body(method)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 185, in _write_stmt_body
self._write_if(part)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 194, in _write_if
self._write_stmt_body(stmt)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 187, in _write_stmt_body
self._write_else(part)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 203, in _write_else
self._write_stmt_body(stmt)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 185, in _write_stmt_body
self._write_if(part)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 194, in _write_if
self._write_stmt_body(stmt)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 189, in _write_stmt_body
self._write_stmt_body(part)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 181, in _write_stmt_body
self.writer.writeln(self._convert_exec(part.expr))
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 209, in _convert_exec
ret += self.to_code(parsed_stmt)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 225, in to_code
return self._conv_call(node)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 143, in _conv_call
caller = self.to_code(node.func)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 204, in to_code
return self._conv_attribute(node)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 229, in _conv_attribute
val = self.to_code(node.value)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 225, in to_code
return self._conv_call(node)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 143, in _conv_call
caller = self.to_code(node.func)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 204, in to_code
return self._conv_attribute(node)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/php/__init__.py", line 229, in _conv_attribute
val = self.to_code(node.value)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 222, in to_code
return self._conv_list_subscript(node)
File "/usr/local/lib/python3.9/site-packages/LstGen-0.5.2-py3.9.egg/lstgen/generators/ast2code.py", line 137, in _conv_list_subscript
self.to_code(node.slice.value) +
AttributeError: 'Name' object has no attribute 'value'
tina-junold commented
@jenner can you help, please?
jenner commented
Hi, this seems to be an issue introduced by python3.9, I need to investigate a bit...
jenner commented
@tburschka That's definitely a breaking change in python 3.9 ast module, the code works just fine with python 3.8 and below. If all you need is PHP source you should try to use a lower python version to generate the code.