Author Topic: Python stack trace, double click on any trace line to go to that file/line  (Read 1519 times)

rowbearto

  • Senior Community Member
  • Posts: 1769
  • Hero Points: 119
When I run a Python program and it has an error, I'd like to click on any line of the trace output and go to the file/line it is referring to.

For example, from pymsgs.tar.gz that I recently uploaded to support, there is a stack trace:

Code: [Select]
Traceback (most recent call last):
  File "/home/rbresali/nasdirs/nas/sebugs/pymsgs/pymsgs.py", line 8, in <module>
    main()
  File "/home/rbresali/nasdirs/nas/sebugs/pymsgs/pymsgs.py", line 6, in main
    func1()
  File "/home/rbresali/nasdirs/nas/sebugs/pymsgs/pymsgs.py", line 3, in func1
    raise RuntimerError("Error on purpose")
NameError: name 'RuntimerError' is not defined

I'd like to be able to double click on any of the above lines with ' File "", line #' and go to that line number.

When I debug in Eclipse pydev it provides hyperlinks for these lines so you can go to those files. Would be nice to have equivalent functionality in SlickEdit.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1372
  • Hero Points: 127
Re: Python stack trace, double click on any trace line to go to that file/line
« Reply #1 on: September 30, 2019, 06:09:02 pm »
That's strange, I expected that just the default error parsing entry would do that, but for me it brings up the file referenced, but doesn't go to the correct line.  I'll take a look at it.

rowbearto

  • Senior Community Member
  • Posts: 1769
  • Hero Points: 119
I think the default error parsing should only take one to the final line with an error as that is the one that generates the error. This is what it does now and I think that is correct.

Would be nice to have other means to go to the other lines in the stack trace though, perhaps a right click entry? In eclipse each line of the stack trace is a hyperlink, that would also be real nice. Could probably write a macro to right click on the line and have an entry "Go to python file/line" for stack trace entries.

rowbearto

  • Senior Community Member
  • Posts: 1769
  • Hero Points: 119
Re: Python stack trace, double click on any trace line to go to that file/line
« Reply #3 on: February 01, 2020, 02:43:51 pm »
Patrick: Was wondering if you looked at this?

Correction to my last post: What I wrote is incorrect:

Quote
I think the default error parsing should only take one to the final line with an error as that is the one that generates the error. This is what it does now and I think that is correct.

That is not accurate, and not what I would like.

What Patrick wrote is correct, you double click on a line and it opens the file but doesn't go to the line. Actually you have to double click on the characters of the line with the file name, if you click anywhere outside the file name on the line it gives you an error.

I have an error parser which the validation shows is extracting the correct line number:

Code: [Select]
File \"{#0[^"]+}\", line {#1:i}
Would be nice if I could click on any line in the stack trace and it takes me to the right file AND line number for that line. Its getting very annoying that SE doesn't do that.

FYI: eclipse and pycharm show hyperlinks at each error line, as well as highlighting the errors in different colors, see attached screenshots. But I'd settle for just clicking the desired line in SE and taking me to the file AND line#.

I've attached a sample project that illustrates the problem. In this sample project, I have both "Execute" and "Build" in my configuration "Debug", both have this problem.
« Last Edit: February 01, 2020, 02:49:17 pm by rowbearto »