TemPlateSyntaxError

111 views
Skip to first unread message

Adylek

unread,
Oct 6, 2021, 11:09:20 AM10/6/21
to oTree help & discussion
Hello everyone.
Today I tried to  run otree to practice to research.
when I had reached the result page, TemPlateSyntaxError is occurred.
The sentence is  "All content must be inside a block tag (line 1, in "")".
HTML is like this,
{% extends "global/Page.html" %}
{% load otree static %}

{% block title %}
result
{% endblock %}

{% block content %}

how should I do to repair this?
when i tried in Demo mode, it hadn't any problems.
Please let me know!!

P.S. My English level is not so good. I'm apologize for everyone if I made some grammar mistakes..

Chris @ oTree

unread,
Oct 6, 2021, 11:19:47 AM10/6/21
to oTree help & discussion
I tried pasting that code into a template, and it worked fine for me. i didn't get an error. can you attach the exact template file that is producing the error?

Adylek

unread,
Oct 6, 2021, 11:24:46 AM10/6/21
to oTree help & discussion
Yes. I can't find the reason.
well, this is a picture of the error code.
can you check it?
スクリーンショット (71).pngc

2021年10月7日木曜日 0:19:47 UTC+9 Chris @ oTree:

Adylek

unread,
Oct 6, 2021, 11:26:37 AM10/6/21
to oTree help & discussion
I forgot to add.
{% extends "global/Page.html" %}
{% load otree static %}

{% block title %}
result
{% endblock %}

{% block content %}
is seisan_Results.html.

2021年10月7日木曜日 0:24:46 UTC+9 Adylek:

Chris @ oTree

unread,
Oct 6, 2021, 11:31:21 AM10/6/21
to oTree help & discussion
every "block" needs a corresponding "endblock". there is no endblock for content.
if the error still persists after that, please attach the .html file to your post so i can try it myself. (attaching the actual file is better than just pasting its contents into your message)

Adylek

unread,
Oct 6, 2021, 11:53:15 AM10/6/21
to oTree help & discussion
I'm so sorry.
I mistook to uploaded. Somehow, I send it for Chris directly.
i should have to open it for everyone.
File is the same one. 
2021年10月7日木曜日 0:31:21 UTC+9 Chris @ oTree:
seisan_Results.html

Chris @ oTree

unread,
Oct 6, 2021, 11:57:05 AM10/6/21
to oTree help & discussion
OK now I see the issue. oTree templates need to be UTF-8 encoded. This file contains a byte-order mark (BOM), which is not typical in UTF-8 files. When I removed it, the issue is resolved. I'm not sure how the BOM got there originally, but you can remove the BOM from a file in most text editors.

Adylek

unread,
Oct 6, 2021, 12:10:11 PM10/6/21
to oTree help & discussion
Thanks so much!
I got it!!
thank you for your corporation.

2021年10月7日木曜日 0:57:05 UTC+9 Chris @ oTree:
Reply all
Reply to author
Forward
0 new messages