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

Broken on Python 3 with a custom template #47

Closed
dstufft opened this issue Mar 7, 2017 · 0 comments
Closed

Broken on Python 3 with a custom template #47

dstufft opened this issue Mar 7, 2017 · 0 comments

Comments

@dstufft
Copy link
Contributor

dstufft commented Mar 7, 2017

Trying to use a custom template on Python 3.x results in:

Loading template...
Finding news fragments...
Rendering news fragments...
Traceback (most recent call last):
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/bin/towncrier", line 11, in <module>
    sys.exit(_main())
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/towncrier/__init__.py", line 36, in _main
    return __main(draft, directory, project_version, project_date)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/towncrier/__init__.py", line 74, in __main
    rendered = render_fragments(template, fragments, definitions)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/towncrier/_builder.py", line 101, in render_fragments
    jinja_template = Template(template, trim_blocks=True)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/jinja2/environment.py", line 945, in __new__
    return env.from_string(source, template_class=cls)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/jinja2/environment.py", line 880, in from_string
    return cls.from_code(self, self.compile(source), globals, None)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/jinja2/environment.py", line 581, in compile
    defer_init=defer_init)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/jinja2/environment.py", line 543, in _generate
    optimized=self.optimized)
  File "/Users/dstufft/.virtualenvs/tmp-46f4170e7667d3a/lib/python3.6/site-packages/jinja2/compiler.py", line 78, in generate
    raise TypeError('Can\'t compile non template nodes')
TypeError: Can't compile non template nodes

It appears this is because the template is being read as bytes instead of a string.

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