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 exception when building from source #28

Closed
omkarkarande opened this issue Nov 23, 2021 · 3 comments
Closed

Jinja2 exception when building from source #28

omkarkarande opened this issue Nov 23, 2021 · 3 comments

Comments

@omkarkarande
Copy link
Contributor

Describe the bug
When building the theme from source (running sublate from the theme/jetbrains folder) results in an exception.

~/Workspaces/Personal/monokai-pro/theme/jetbrains master*
❯ sublate
Building: .
Building: ./screenshots
Building: ./resources
Building: ./resources/schemes
Traceback (most recent call last):
  File "/usr/local/bin/sublate", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 28, in main
    build(args.path, args.output, args.render, args.remove, data)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 42, in build
    _build(path, output_path, data, render, remove, path)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 116, in _build
    _build(full_path, full_output_path, data, local_render, remove, root_path)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 116, in _build
    _build(full_path, full_output_path, data, local_render, remove, root_path)
  File "/usr/local/lib/python3.9/site-packages/sublate.py", line 131, in _build
    output = template.render(**data).strip()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "./resources/schemes/default-no-italics.xml", line 4, in top-level template code
    {% include "templates/scheme.xml" %}
  File "./templates/scheme.xml", line 2, in top-level template code
    <scheme name="{{theme.name}}{% if not italics %} - No Italics{% endif %}" version="142" parent_scheme="Darcula">
  File "/usr/local/lib/python3.9/site-packages/jinja2/environment.py", line 471, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'default' is undefined

To Reproduce
Steps to reproduce the behavior:

  1. Clone this repository
  2. cd into theme/jetbrains
  3. run sublate
@omkarkarande
Copy link
Contributor Author

Running sublate from project root results in recursive calls where it tries to create an output folder multiple times within each of the created output folders.

E.g.

Building: ./output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output
Building: ./output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output
Building: ./output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output/output

@omkarkarande
Copy link
Contributor Author

Created a PR to address this - #30

@espositocode
Copy link
Collaborator

Cherry picked your fix into master. Thanks.

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

2 participants