In practice, the most common way to debug a Blend script is simply to insert temporary statements that provide messages or output for yourself as a developer to inspect. When you are done debugging, you remove these statements.
To write output to the console during script execution, call:
To output data elements as a response to the console, perhaps in order to see whether certain data are available, for string data, call:
and for node sets, call:
To send this type of debug information to a file instead of the console, redirect it:
> usoft-bindir\ublendit.exe script-file >log.xml
When debugging long scripts, you can temporarily skip sections by commenting them out:
but it is often more practical to debug code blocks as stand-alone scripts and paste the result back into the original script when you are satisfied with it. To debug longer sections, clone the entire Blend script as a second .XML file, remove from this second script all the sections you are not interested in, debug what remains, and paste the debugged code back into the original.