Information
Unsupported content This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Debugging Jython


The Jython debugger module is called pdb. (The 'p' in 'pdb' stands for Python — Jython is just a Java port of Python). The pdb module lets you debug Jython scripts, line-by-line.

To run a script in debug mode, import the pdb module and insert the set_trace() function call near the beginning of the script or where you suspect problems:

import pdb
pdb.set_trace()

Run the script from the CLI. The script will pause, expecting input, when it reaches the pdb.set_trace() line in the script's execution. You can use the following commands to navigate the debugger.

Command

Description

n

Executes the next line of the script.

l

Lists 10 lines of script above and 10 lines below the current position.

s

Steps into the function in the next line of the script.

b line_number

Sets a break point at the specified line number.

c

Continues execution uninterrupted until the next break point.

r

Continues executing the function in current scope until it returns.

p variable

Print the value of the variable in the current scope.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Server Automation 8.3