NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a Sequence with Python Release Error

Hi,

 

I found a python script online that allows me to call a teststand sequence. The sequence is very simple, I am basically monitoring a voltage for hours at a time. The sequence will open and take one voltage measurement, but I am running into an error regarding the releasesequencefileex() function.

import win32com.client

tsEngine = win32com.client.Dispatch('TestStand.Engine.1')
print('TestStand %s.%s ready' % (tsEngine.MajorVersion, tsEngine.MinorVersion))
sequencePath = 'C:\\My Directory\\My Sequence.seq'
seqFile = tsEngine.GetSequenceFileEx(sequencePath)
execution = tsEngine.NewExecution(seqFile, "MainSequence", None, False, 0)
execution.WaitForEndEx(60000)
print(execution.ResultStatus)
tsEngine.ReleaseSequenceFileEx(seqFile, 0x4)

 The error I am getting is shown below.

 

Python Sequence Caller Error.PNG 

 

Any help would be greatly appreciated.

 

Thanks,

Aaron

0 Kudos
Message 1 of 6
(3,792 Views)

Hi Aaron,

 

What process model are you using? 

 

This article might be helpful: http://digital.ni.com/public.nsf/allkb/21157F2B22A0FE1C86256E52007C0BED?OpenDocument

 

Best,

Misbah

0 Kudos
Message 2 of 6
(3,771 Views)

Does this line return true or false?


@aaron660
execution.WaitForEndEx(60000)

 

https://www.linkedin.com/in/trentweaver
0 Kudos
Message 3 of 6
(3,768 Views)

I am not sure what the process model refers to. I am running TestStand 2016 and Python 3.7.

0 Kudos
Message 4 of 6
(3,758 Views)

It does not appear to return anything in the python.exe window.

0 Kudos
Message 5 of 6
(3,744 Views)

@aaron660 wrote:

 

execution.WaitForEndEx(60000)
print(execution.ResultStatus)
tsEngine.ReleaseSequenceFileEx(seqFile, 0x4)

 The error I am getting is shown below.

 

Python Sequence Caller Error.PNG 

 


The WaitForEndEx(60000) will cause the Python program to wait only one minute for the sequence to finish executing before it then gets the ResultStatus and tries to release the sequence. Unsurprisingly this will fail if, as you're expecting the sequence is still running after one minute.

 

One fairly straightforward alternative could be to poll for UIMessages to look for the end execution message.


Message 6 of 6
(3,710 Views)