Visidata: [question] How do you debug visidata?

Created on 16 May 2020  路  4Comments  路  Source: saulpw/visidata

One does not simply debug visidata using pdb or print commands. How do you debug visidata?flag
It's possible to see stack traces.

question

Most helpful comment

Adding a link to @ajkerrigan's helpful notes:

https://github.com/ajkerrigan/visidata-plugins#debugging_helpers-integrate-visidata-with-debugging-packages

At some point I (or someone) should add this to the visidata dev notes.

All 4 comments

I use Ctrl+E to view errors that appear on the status line, and z Ctrl+E to view errors that appear in cells (noted with ! or ? in the cell). If I've introduced an error so egregious that it prevents even the error from being displayed, Ctrl+Q will quit and dump the last error to the console.

In addition, Ctrl+Y will open the current row as a Python object, and g Ctrl+Y opens the current sheet, and z Ctrl+Y opens the current cell. Each of these are useful when trying to figure out the internal state of a sheet/row/value, depending on what I'm trying to debug.

Finally, I will use the tried-and-true print-style debugging method, by sprinkling vd.status("whatever") lines throughout the code. These show up on the status line, and Ctrl+P will view them all (in reverse order).

These are the general tactics that occur to me off the top of my head, but there are others I will use depending on the specific problem (e.g. for performance issues, Ctrl+_ will turn on profiling, then I do the action, then Ctrl+T to view the threads sheets and then Enter to view the hotspots in the profile of that thread). If you are trying to debug something specific, you can mention it here and maybe we can come up with a technique that will make it easier.

Do you ever drop into a debugger like pdb?

Not in VisiData, no. It sounds nice to be able to use pdb or another similar debugger, but I haven't put the time into integrating it. I think vd itself could be a wonderful debugger interface, both for Python pdb and for e.g. gdb with other languages. Maybe someday.

Adding a link to @ajkerrigan's helpful notes:

https://github.com/ajkerrigan/visidata-plugins#debugging_helpers-integrate-visidata-with-debugging-packages

At some point I (or someone) should add this to the visidata dev notes.

Was this page helpful?
0 / 5 - 0 ratings