Troubleshooting - Python Programs
This section describes what actions you can take to ascertain whether your Python programs are executing and running to completion successfully. This section applies to Python programs that are triggered by Geo SCADA Expert.
Remember that your Geo SCADA Expert servers have to be running Geo SCADA Expert 2025 or later in order to support Python programs. Additionally, the User Account under which a Python program runs has to have the relevant access and permissions that are required for that program to run to completion successfully (see Specify the User under which a Python Program Runs).
To ascertain whether your Python programs are executing successfully, you can:
The Python Programs List is a Queries List that you can access from the Queries Bar (see Display a Queries List). The List includes information about the programs' State, Quality, last Error Message and Error Timestamp (if any), Last Start Time, Last Run End Time, and Last Runtime. It also includes the last StdErr and StrErr Timestamp (if any), and the last StdOut and StdOut Timestamp (if any). Also the Run Count (the number of times that the program has been run), and the Last Exit Code. This latter code is returned by the Python program itself. A 0 (zero) exit code indicates that the program ran to completion successfully; any other exit code number indicates that issues were detected when attempting to run the program. The writer of the program will be able to provide information about the meaning of any non-zero exit code numbers. An exit code of 1 might also indicate that the Stop pick action or method was used to discontinue a program run (see Stop).
For further information about any of the column headings in the List, move the cursor over the column headings to display a ToolTip. Alternatively, refer to the Database Schema (see Working with the Database Schema).
In addition to some of the information that appears in the Python Programs List, the Status display for an individual Python Program also provides details such as the Average Runtime and the Longest Runtime. It also shows the Run Timeouts (the number of times that the program exceeded its runtime limit), and the number of Discarded Pending Executions (the number of requested executions of the program that the server discarded due to the queue being full).
For more information, see Status Attributes that are Specific to the Python Driver.
We provide a number of program-related categories in the Python branch of the Server Status Tool. These include statistics about the Longest Running and Most Frequently Run Python programs.
You can reset the statistics counts for all active Python Programs from some of the displays in the Server Status Tool. Such resets also impact the counts that appear in the other displays (the Python Programs List and the Status displays of each Python program). To reset the counts for just one specific Python Program, use the Reset Counts pick action on the database item for that Python Program in ViewX.
For more information, see Python Status Information.
View the Content of a Long Message
This section applies to long ErrorMsg, StdErr, and StdOut messages.
The length of any output from a Python program, such as an error message when a program exits unexpectedly, can vary. You can view ErrorMsg, StdErr, and StdOut messages in the Python Programs List (see above). If a message is long, or you want to make a copy of the message content, you might find it easier to view the message via other means. The means by which you can view long message include:
-
Display the OPC Data Bar (see Display an Explorer Bar in ViewX in the Geo SCADA Expert Guide to ViewX and Virtual ViewX Clients).
-
In the OPC Data Bar, locate the Python Program item to which the error message relates.
-
Expand the tree structure of that database item and locate the ErrorMsg, StdErr, or StdOut property, as applicable.
-
Double-click on the property to display a window that provides information about that property.
The content of the message is displayed in the Value field. -
You can view the message in the window, and can copy and paste the message into another display or application if required.
(Be aware that long messages might be truncated in the window, however the full message content will be included in the copy and paste activity.)
For more information, see Access Property Tags in the Geo SCADA Expert Guide to Core Configuration.
ErrorMsg and StdErr messages are included in the Python driver log files.
You can access the log files from the Modules section of the Server Status Tool. To do this:
-
Expand the General branch and select the Modules entry.
The display provides information about the drivers that are installed in Geo SCADA Expert. -
Locate the Python entry and right-click on the entry to display a context-sensitive menu.
-
Select the Log Files entry and view the relevant Python driver log file.
-
Search the log file for content such as:
exited with code
-
Any error messages should appear shortly after any non-zero exit code entries.
For information about accessing driver log files, see Display a Driver Log File.