You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Python Editor: error output doesn't say which file failed, and the line number is wrong #663
Describe the bug
When a script from the Python Editor raises an exception, the console prints:
<Execute Python Editor content>
NameError: name 'x' is not defined
At:
<string>(2): <module>
Two problems with that:
It doesn't say which tab/file was executed. With several scripts open (explore.py, quirk_a.py, quirk_b.py), I can't tell from the output which one failed.
The line number is wrong. quirk_b.py contains a single line, print(x), but the error points to line 2.
To Reproduce
Open HAL.
Open the Python Editor and create a new tab, e.g. quirk_b.py.
Put exactly one line in it:
print(x)
Run the editor content.
The console prints <string>(2): <module> — no file name, and line 2 in a one-line file.
Expected behavior
A normal Python traceback naming the file, the line and the offending source line:
Traceback (most recent call last):
File "quirk_b.py", line 1, in <module>
print(x)
^
NameError: name 'x' is not defined
Screenshots
Desktop (please complete the following information):
OS: Windows 11 Pro (10.0.26300)
Version: 4.5.0 (v4.5.0-147-gff98e36c6)
Additional context
Would a plain Python traceback be preferable here, or is the current short form intentional? Even keeping the short form, the file name and a correct line number would help a lot — right now the offset makes it hard to find the error in longer scripts.
Activity