Author Topic: Python debugger, watches  (Read 516 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2587
  • Hero Points: 209
  • Text
Python debugger, watches
« on: January 13, 2022, 07:31:07 pm »
WRT The watch tool window in the python debugger:

#1: Sometimes some entries show all in red.
In my live debug session right now 3 entries show up in red, but they apparently work correctly.

When I specifically add a variable that doesn't exist, I get "NameError( ... )" , and it isn't in red (well, sometimes it is, sometimes not).

In the attached picture, I added "foobar" and it didn't show up as red.
Then I went to the previous stack frame, added "parent_item" (A local variable in that frame).
I returned to the top stack frame.
Now "foobar" is red, and "parent_item" is not.

#2: It is also very odd that "NameError" is an expandable variable (the exception returned by python?) instead of simply an message like "Not defined".



I've also had this dialog pop at least once when trying to add a undefined variable to watch:
---------------------------
SlickEdit Pro
---------------------------
Error querying watch:  Index of debugger item is out of range or invalid
---------------------------
OK   
---------------------------


Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3725
  • Hero Points: 490
Re: Python debugger, watches
« Reply #1 on: January 14, 2022, 01:59:56 pm »
The intention is for a variable to show up in red when it is modified.  In your case, it may have shown up as red because we did not have a previous value for 'foobar' for the previous stack frame.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1744
  • Hero Points: 148
Re: Python debugger, watches
« Reply #2 on: January 14, 2022, 02:12:42 pm »
#1 As Dennis said the red is the probably the variable changed color.

That being said, stepping through some of my test projects, I do see some cases where the color is wrong for reasons I don't understand, without doing anything to mess with previous stack frames.  I'll take a closer look at that later today or on Monday, it could be I have a bug in the code that sets up the values for the debugger UI.

#2 It is the exception.  The idea was that there might be some helpful extra info in the exception object.   It doesn't happen often in practice that I've seen, and definitely not for the exceptions thrown by the runtime.    So I could probably have it just display an error, and only show the exception if it has some non-standard fields in it.  I'll think about it.



patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1744
  • Hero Points: 148
Re: Python debugger, watches
« Reply #3 on: January 17, 2022, 08:41:40 pm »
I found the cause of the "variable modified" color not being accurate in the Python debugger.  I'm working on a fix for it.  It's not hot fixable, so it will go in for the v26.0.2. point release.