Skip to content
New issue

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

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

Already on GitHub? # to your account

TypeError: sequence item 0: expected str instance, int found #1701

Closed
phemmer opened this issue Aug 9, 2022 · 0 comments · Fixed by #1702
Closed

TypeError: sequence item 0: expected str instance, int found #1701

phemmer opened this issue Aug 9, 2022 · 0 comments · Fixed by #1702
Milestone

Comments

@phemmer
Copy link

phemmer commented Aug 9, 2022

import jinja2
from jinja2.nativetypes import NativeEnvironment
NativeEnvironment().from_string('{% block test %}{% for i in range(1) %}{{ loop.index }}{% endfor %}{% endblock %}{{ self.test() }}').render()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/phemmer/.local/lib/python3.10/site-packages/jinja2/nativetypes.py", line 112, in render
    return self.environment.handle_exception()
  File "/home/phemmer/.local/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/phemmer/.local/lib/python3.10/site-packages/jinja2/nativetypes.py", line 25, in native_concat
    head = list(islice(values, 2))
  File "<template>", line 1, in top-level template code
TypeError: sequence item 0: expected str instance, int found

Environment:

  • Python version: Python 3.10.5

  • Jinja version: 3.1.2

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants