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

Missing line info from syntax error message #1737

Open
janosroden opened this issue Oct 19, 2022 · 0 comments
Open

Missing line info from syntax error message #1737

janosroden opened this issue Oct 19, 2022 · 0 comments

Comments

@janosroden
Copy link

I have an issue with TemplateSyntaxError.__str__() meaning it doesn't show the relevant line because its translated attribute is True. However both source and lineno are correct.

I'm just started using the lib so I don't know the deeper cause, but my use case seems legit:

with open(htmlTemplatePath, 'r') as f:
   htmlTemplate = jinja2.Environment().from_string(f.read())

The str(err) is unexpected '}', but what I expect is

unexpected '}'
  line 354
    <td rowspan="2" class="primaryTableHeader verticalTableHeader">{{ PH }???}</td>

If I set err.translated = False I get that helpful message.

Environment:

  • Python version: 3.8.10
  • Jinja version: 3.1.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant