jenner / LstGen

Code-Generator für die Lohnsteuerberechnung aus PAP XML
MIT License
47 stars 16 forks source link

2010 generator: AttributeError: 'NoneType' object has no attribute 'replace' #13

Closed knipknap closed 4 years ago

knipknap commented 4 years ago

The 2010 generator is causing an exception:

lstgen -p 2010 -l python --class-name BmfTax --outfile app/bmf/tax2010.py
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:999: InsecureRequestWarning: Unverified HTTPS request is being made to host 'www.bmf-st
euerrechner.de'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warn
ings
  warnings.warn(
Traceback (most recent call last):
  File "/usr/local/bin/lstgen", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/lstgen/cli.py", line 161, in main
    generator.generate()
  File "/usr/local/lib/python3.8/dist-packages/lstgen/generators/python/__init__.py", line 67, in generate
    self._write_constructor()
  File "/usr/local/lib/python3.8/dist-packages/lstgen/generators/python/__init__.py", line 102, in _write_constructor
    value=self.convert_to_python(var.default)
  File "/usr/local/lib/python3.8/dist-packages/lstgen/generators/python/__init__.py", line 168, in convert_to_python
    tree = ast.parse(prepare_expr(value))
  File "/usr/local/lib/python3.8/dist-packages/lstgen/__init__.py", line 26, in prepare_expr
    source = source.replace(key, repl)
AttributeError: 'NoneType' object has no attribute 'replace'

The resulting Python module is then incomplete.

jenner commented 4 years ago

Seems like a python >= 3.8 issue, I'll look into it

jenner commented 4 years ago

No, it's a missing default value for a "double" input variable, I guess I've never run code for 2010 :)

knipknap commented 4 years ago

Great, Thanks! Could you also push a new release to PyPi? :-)

jenner commented 4 years ago

Will do after #14 is merged