Incorrect message when non-ascii char appears in template
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
Research direction
Start by inspecting lexer.py around line 215 and reproduce the failure using a template such as templates/summary.html containing a non-ASCII character. Trace how the parser determines the reported position and encoding failure. Done means the error identifies the relevant location instead of reporting line 0, char 0, with the intended encoding behavior clarified.
Written by the indexing model from the issue text.
Description
Migrated issue, originally created by Glenn WIkle
You might think it is minor to have default values in an exception message but given that Mako is a parsing system, users need more help figuring out where the incorrect syntax is in their input files.
In the current version of lexer.py line 215 is this:
0, 0, filename)
i think the two zeros here result in the message which looks like
Unicode decode operation of encoding 'ascii' failed in file 'templates/summary.html' at line: 0 char: 0
So any non-ascii char anywhere in the input file template will generate this same message.
I spent quite a while looking for unprintable characters in my template at 0,0 before I dug into the code to find that the non-ascii character was really in a different position.
(Next I'll have to figure out why it's restricting the character set to ascii)
- Dominant language
- Python
- Stars
- 459
- Forks
- 90
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sqlalchemy/mako
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
sqlalchemy/mako#432 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
sqlalchemy/mako#417 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
sqlalchemy/mako#392 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
sqlalchemy/mako#382 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
sqlalchemy/mako#376 · 9 comments ·
Similar issues
-
sponsored
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Diaoul/subliminal#1382 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100