Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jinja2.exceptions.UndefinedError: 'None' has no attribute 'py_include_statement' #13

Open
rafalkrupinski opened this issue Aug 15, 2022 · 0 comments

Comments

@rafalkrupinski
Copy link

Hi,
I'm trying to parse JSON Schema for OpenAPI 3 specification, and I'm getting a most cryptic error coming somewhere from jinja or a template.

Any hints on what could cause the problem?

  File "/Users/matte/Documents/Projects/lapis/src/lapis/__main__.py", line 9, in main
    generator.Generate(yaml.safe_load(fp), 'Example', 'example', 'example')

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jsonschemacodegen/python.py", line 51, in Generate
    return generator.render_template(template_name="file.py.jinja2", output_name="{}.py".format(filename_base), resolver=self.resolver, **args)

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jacobsjinjatoo/templator.py", line 92, in render_template
    rendered = template.render(kwargs)

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jinja2/environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jsonschemacodegen/templates/python/file.py.jinja2", line 8, in <module>
    {{importer.GetImports(resolver, schema, includes)}}

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jinja2/runtime.py", line 828, in _invoke
    rv = self._func(*arguments)

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jsonschemacodegen/templates/python/import.py.jinja2", line 67, in <module>
    {%-            do includes.append(resolver.py_include_statement(prop['$ref']))-%}

  File "/Users/matte/Library/Caches/pypoetry/virtualenvs/lapis-4Aax896p-py3.10/lib/python3.10/site-packages/jinja2/utils.py", line 84, in from_obj
    if hasattr(obj, "jinja_pass_arg"):

jinja2.exceptions.UndefinedError: 'None' has no attribute 'py_include_statement'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant