Skip to content

Instantly share code, notes, and snippets.

@rtuita23
Created February 14, 2015 07:53
Show Gist options
  • Save rtuita23/ee00af0c58faa1b62437 to your computer and use it in GitHub Desktop.
Save rtuita23/ee00af0c58faa1b62437 to your computer and use it in GitHub Desktop.
jinja2.exceptions.TemplateSyntaxError
TemplateSyntaxError: expected token 'as', got 'with'
Traceback (most recent call last)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/action/thinkful/projects/jinja_example/run.py", line 8, in template_test
return render_template('template.html', my_string='Wheeeee!', my_list=[0,1,2,3,4,5])
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template
context, ctx.app)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/flask/templating.py", line 110, in _render
rv = template.render(context)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
return self.environment.handle_exception(exc_info, True)
File "/home/action/thinkful/projects/jinja_example/env/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/action/thinkful/projects/jinja_example/templates/macros.html", line 1, in template
{% import nav_link with context %}
TemplateSyntaxError: expected token 'as', got 'with'
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment