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

`extends` keyword not working in async mode #668

Closed
mohd-akram opened this issue Jan 22, 2017 · 0 comments

Comments

@mohd-akram
Copy link

commented Jan 22, 2017

Expected Behavior

The extends keyword should work in async mode.

Actual Behavior

This error happens: SyntaxError: 'yield from' inside async function.

Template Code

{% extends 'base.html' %}

Full Traceback

Exception occurred while handling uri: "/1"
Traceback (most recent call last):
  File "/Users/mohamed/.virtualenvs/item.tf/lib/python3.6/site-packages/sanic/sanic.py", line 208, in handle_request
    response = await response
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/coroutines.py", line 109, in __next__
    return self.gen.send(None)
  File "main.py", line 88, in item
    description=' | '.join(desc_list))
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/asyncio/coroutines.py", line 109, in __next__
    return self.gen.send(None)
  File "main.py", line 307, in render
    template = jinja_env.get_template(template)
  File "/Users/mohamed/.virtualenvs/item.tf/lib/python3.6/site-packages/jinja2/environment.py", line 833, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "/Users/mohamed/.virtualenvs/item.tf/lib/python3.6/site-packages/jinja2/environment.py", line 807, in _load_template
    template = self.loader.load(self, name, globals)
  File "/Users/mohamed/.virtualenvs/item.tf/lib/python3.6/site-packages/jinja2/loaders.py", line 125, in load
    code = environment.compile(source, name, filename)
  File "/Users/mohamed/.virtualenvs/item.tf/lib/python3.6/site-packages/jinja2/environment.py", line 590, in compile
    return self._compile(source, filename)
  File "/Users/mohamed/.virtualenvs/item.tf/lib/python3.6/site-packages/jinja2/environment.py", line 552, in _compile
    return compile(source, filename, 'exec')
  File "templates/item.html", line 15
    
    ^
SyntaxError: 'yield from' inside async function

Your Environment

  • Python version: 3.6
  • Jinja version: 2.9.4

@davidism davidism added the bug label Jan 24, 2017

@mitsuhiko mitsuhiko closed this in 8df94bd Jan 24, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.