How to debug a pvpython script

The first thing to look at would be if there are any error messages. If there are, those might point the way to solving the bug. They will at least tell you the offending line in your Python script. If the problem is that there is no output, the next thing to look at would be to see if there are any calls to SaveData or SaveScreen. Make sure there is one, depending on whether you are trying to save data or images.

If the problem is that some properties are changed that should affect the generated image but they are not being shown, make sure to call Render or RenderAllViews.

If none of those work, then commenting things out until you get to a script that gives you an intermediate result that is expected is a good thing to do, at which point you can add things in incrementally until you identify the change that isn’t working.

Alternatively, it is possible to use pdb, the python debugger, to debug your code.
add this in your code:

import pdb; pdb.set_trace()

Then run your script with pvpython or ParaView directly.
See here for more info:

1 Like