# Troubleshooting Python scripts

You can add print statements to your Python scripts as a troubleshooting aid. The output of the print statement is written to the User Operator Output dialog box as shown in the following picture. Each time that the script is executed, which is once per waveform acquisition, the print statements are executed. It is often helpful to set Infiniium's data acquisition to Single mode and then click the Single button to control the output. Example of printing all input variables.

The following script was used to print the values of two local variables within the script. The above picture represent the output of one waveform acquisition.

OperatorTest.py
    def algorithm(variables):
        …
        …
        …
        N = variables['FilterOrder']   # filter order
        Fc = variables['FilterCutoff']   # filter cutoff frequency
        FType = variables['FilterType']   # filter type
        FilterDelay = N * 0.112 / Fc
        FilterWidth = N / Fc
        # Write variables to User Operator Output dialog box
        print(f'FilterDelay: {FilterDelay}')
        print(f'FilterWidth: {FilterWidth}')
        …
        …

## To view the output

1. Add print statements to your script and create your user operator.
2. Click the button on the lower-right corner of the screen to open the Functions dialog box if you have closed it.
3. Click on your operator to open the User Operator Setup dialog box, and click the Show Output... button. This button appears in the dialog box only after the function has been added. If the dialog box is already open, close it, and reopen it to see the Show Output... button
4. Click the Show Output... button as seen in the following picture.
5. The output of the print statements are shown the dialog box.