Skip to content

The location provided when a warning occurs in a python block is not accurate #430

@rdan

Description

@rdan

With the following code preceded by 10 empty lines:

<%
   print("\j")
%>

I get

<unknown>:1: SyntaxWarning: invalid escape sequence '\j'
memory:0x18bf4657080:36: SyntaxWarning: invalid escape sequence '\j'

"1" is ok (first line in the block "<%%>") but "36" is odd.

And with the following code preceded by 10 empty lines:

<%!
   print("\j")
%>

I get

<unknown>:1: SyntaxWarning: invalid escape sequence '\j'
memory:0x199007f7080:16: SyntaxWarning: invalid escape sequence '\j'

"1" is still ok but now "36" is replaced by "16" which is still odd.

For sure, in this use case, I just need to search for "\j" and I will find my error but in the case of a message not so clear, then the location of the warning could be far more complicated.

At the end, the ideal would be to have the same information as for an error (either directly the line number in the template or the line number of the start of the block + the line number inside the block).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions