NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python script to open Teststand seq files

Hi,

 

I am using python to open very simple teststand seq file as shown below:

 

import win32com.client

try:
tsEngine = win32com.client.Dispatch('TestStand.Engine.1')

sequencePath = 'Sequence File 1.seq'
seqFile = tsEngine.GetSequenceFileEx(sequencePath)
execution = tsEngine.NewExecution(seqFile, "MainSequence", None, False, 0)
execution.WaitForEndEx(60000)
print(execution.ResultStatus)

released = tsEngine.ReleaseSequenceFileEx(seqFile, 0x4)

except Exception as ex:
print(ex)

Using the above code, I am able to open the seq file, and get the ResultStatus at the end of the execution.

After that, I called ReleaseSequenceFileEx() to release the reference to the seq file.

However, I encountered the following Teststand's warning very frequently.

Please help.

 

The Engine.ReleaseSequenceFile(Ex) method was not called for the following files:
    C:\Program Files\National Instruments\TestStand 2016\Components\Callbacks\Station\StationCallbacks.Seq
    C:\Users\Public\Documents\National Instruments\TestStand 2016 (64-bit)\Components\Callbacks\Station\StationCallbacks.Seq


References to PropertyObjects were not released properly.
    Total number of objects: 228
    Number of top-level objects: 19

    Note: Some top-level objects may be included if they are referenced by
    an incorrectly released top-level object. For example, an unreleased
    SequenceContext object references a SequenceFile object.

    The following top-level objects were not released:

        Executions [1 object(s) not released]


        Files [2 object(s) not released]
            SequenceFile #1:
                Path: C:\Program Files\National Instruments\TestStand 2016\Components\Callbacks\Station\StationCallbacks.Seq

            SequenceFile #2:
                Path: C:\Users\Public\Documents\National Instruments\TestStand 2016 (64-bit)\Components\Callbacks\Station\StationCallbacks.Seq


        Type Definitions [3 object(s) not released]
            Type Definition #1:
                Name: CommonResults

            Type Definition #2:
                Name: Error

            Type Definition #3:
                Name: Path


        PropertyObjects [8 object(s) not released]
            PropertyObject #1:
                Type: Obj

            PropertyObject #2:
                Type: Number
                Value: 0

            PropertyObject #3:
                Type: Number
                Value: 0

            PropertyObject #4:
                Type: Number
                Value: 0

            PropertyObject #5:
                Type: Number
                Value: 0

            PropertyObject #6:
                Type: Array of Containers

            PropertyObject #7:
                Type: Array of Containers

            PropertyObject #8:
                Type: Array of Containers


        And the following uncategorized objects:
            UIMessage (TEMessage)

            Report

            TypeUsageList (Obj)

            TypeUsageList (Obj)

            EditArgs

0 Kudos
Message 1 of 2
(3,556 Views)

I've been doing some work with the Using Python to Run TestStand Sequence File example code and found that to make it close cleanly I need to both handle UIMessages so that there are none outstanding when the code finishes executing and also to use del in Python to remove the seqFile and execution references after releasing the sequence file.


0 Kudos
Message 2 of 2
(3,196 Views)