Console Window Python Error Parsing Using NppExec



  • Coming from Programmer’s Notepad and Sublime - accustomed to being able to double-click the error message in the output console to jump to line in code generating the error. Trying to use NppExec to yield same effect in Notepad++. The examples for this type of functionality seem to be limited to parsing gcc type output and I can’t seem to make the jump to correctly parsing corresponding Python error messages.

    Specifically, I’d like to parse a line like the following:
    Traceback (most recent call last):
    File “Main.py”, line 15, in <module>
    start = foo()
    AttributeError: ‘module’ object has no attribute ‘foo’

    Trying something like %FILE%, %LINE% in NppExec yields
    "C:\File “Main.py” doesn’t exist. Create it?

    What would be an appropriate NppExec highlight mask to allow me to double click the “line 15” output to jump to Line 15 in the code?

    Thanks.



  • Hello Gregg-T-Geiger,

    you need to match the line and replace the filename and the linenumber with %FILE% and %LINE%
    So something like

    File “%ABSFILE%”, line %LINE%,

    Cheers
    Claudia



  • I always forget that there are some markdown chars which need to be considered.

    this line

    File “%ABSFILE%”, line %LINE%,
    

    should be

    *File "%ABSFILE%", line %LINE%,*
    

    Sorry for inconvenience
    Claudia
    Claudia



  • Claudia: Your solution works perfectly. Thanks so much!


Log in to reply