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

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

mkrizek added a commit to mkrizek/jinja that referenced this issue Aug 9, 2022
mkrizek added a commit to mkrizek/jinja that referenced this issue Aug 9, 2022
mkrizek added a commit to mkrizek/jinja that referenced this issue Aug 9, 2022
@davidism davidism added this to the 3.1.5 milestone Dec 18, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants