Python runtime error messages
- Last UpdatedOct 29, 2026
- 4 minute read
If an exception occurs during runtime, script execution will halt and the Python exception will be logged if Python logging is enabled.
-
In the AVEVA Edge Studio development environment and the SCADA or Embedded HMI runtimes, the HMI.Trace messages appear in the Studio Output window or the runtime LogWin tool.
-
In the IoT View runtime, the HMI.Trace messages appear in the IoT View runtime log.
You can also use HMI.Trace to log trace statements at any point in a script. These can be used to troubleshoot script problems. HMI.Trace statements after the point of an exception in a script will not be executed.
The output in these examples requires Python logging to be enabled.
Example 1
The following Python Startup Script writes a non-zero value to the tag "runScript001," initializes two variable values, and logs a message when these actions are completed.

The following Python Script worksheet runs if there is a non-zero value in the Execution field (there is a tag in this field with a non-zero value is because of the value written to "runScript001" in the Startup Script). The script does the following:
-
Write a 0 to "runScript001," which will cause this Script worksheet to not execute again after running once. If the tag value is changed to a non-zero value anywhere in the application, this script will run again.
-
Log a message stating that the script is being executed.
-
Perform a math operation using the variables declared in the Startup script. The value is assigned to a variable that can only be accessed in this script.
-
Log a message stating the script has completed execution.

Because the this script is being tested in AVEVA Edge Studio and Python logging has been enabled, the following messages are sent to the LogWin tab of the Output window. The mathematical expression triggers an exception that halts the script execution. The output shows the location (python/SCRIPT0001, line 4) and the type of error (ZeroDivisionError, division by zero). You can also see the Trace messages from the Startup Script and the beginning of the Script worksheet, but not from the end of the Script worksheet, because the script terminated at line 4. If the value in the Execution field was still non-zero, the script will continue to execute and generate messages until the application is halted or the value of "runScript001" is toggled.

Example 2
This Global Python Procedures sheet contains a procedure that has an error: in line 2, there is a double equal sign instead of a single equal sign. The worksheet was saved as Temperature.gis.

The following Python Script worksheet runs if there is a non-zero value in the Execution field, and there a tag in this field with a non-zero value is because of the value written to "runScript002" in the Startup Script (similar to Example 1). The script does the following:
-
Write a 0 to "runScript002," which will cause this Script worksheet to not execute again after running once. If the tag value is changed to a non-zero value anywhere in the application, this script will run again.
-
Log a message stating that the script is being executed.
-
Calculate a number by calling Global Procedure "cel2far" with an argument.
-
Log a message stating the script has completed execution.

Because this script is being tested in AVEVA Edge Studio and Python logging has been enabled, the following messages are sent to the LogWin tab of the Output window. The procedure call triggers an exception that halts the script execution. The output shows the locations in the script (python/SCRIPT0002, line 3) and the procedure worksheet (python/Temperature, line 2, in cel2far), and the type of error (NameError, name 'degf' is not defined). You can also see the Trace messages from the Startup Script and the beginning of the Script worksheet, but not from the end of the Script worksheet, because the script terminated at line 4. If the value in the Execution field was still non-zero, the script would continue execute and generate messages until the application was halted.

If the error is corrected, the Startup Script runs again, and the Output window shows only the Trace messages:
