NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Python to Run TestStand - given example not working

Hi,

 

I tried to run TestStand from python script.

I use example from NI site:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LpMSAU

 

BUT, at the end I got leakage window warning (attached image).

What is the correct way to finish my work?

 

my configuration:

Python version 3.6.4

TestStand 2017

 

 

 

0 Kudos
Message 1 of 4
(3,133 Views)

Hi mirrko,

 

Tested by my computer, it's working for me and my python version is 3.6.5 and TS is 2017.

The simple one is no problem. 

Maybe do you run more complex seq ? 

 

ricky10116_real_0-1582768287282.png

 

 

Thanks

Ricky

 

0 Kudos
Message 2 of 4
(3,096 Views)

Hi ricky,

 

thanks for your reply.

I use similar simple seq (only one statement).

This part works, like on your picture.

But after clicking OK, after the last script line,

TestStand shows me leakage window.

 

Should it be caused by some settings?

 

0 Kudos
Message 3 of 4
(3,078 Views)

Hi guys,

 

since I cannot find the python way,

I'm using C# workaround.

Just want to share with you, maybe it helps someone.

 

Note: this is only a prototype,

all paths are hardcoded for simlicity.

 

In attachements you could find zip with VisualStudio solution.

 

using NationalInstruments.TestStand.Interop.API;
public void ExecuteTestStand()
        {

            // TestStand Environment
            EngineInitializationSettings eis = new EngineInitializationSettings();
            eis.SetEnvironmentPath(@"c:\playground\MyTS\Development.tsenv");

            // Engine
            Engine myEngine = new Engine();
            
            // User
            User admin = myEngine.GetUser("administrator");
            myEngine.CurrentUser = admin;

            // Workspace
            myEngine.OpenWorkspaceFile(@"c:\playground\MyTS\MyWorkspace.tsw");

            // Sequence
            string sequenceFilename = @"c:\playground\MyTS\seq_file_1.seq";
            var flags = 107; //GetSeqFileOptions.GetSeqFile_OperatorInterfaceFlags
            SequenceFile seqFile = myEngine.GetSequenceFileEx(sequenceFilename, flags, TypeConflictHandlerTypes.ConflictHandler_Error);

            // SequenceModel
            string strModel = myEngine.StationModelSequenceFilePath;
            SequenceFile seqModel = myEngine.GetSequenceFileEx(strModel, flags, TypeConflictHandlerTypes.ConflictHandler_Error);

            // Start Exewcution
            Execution exec = myEngine.NewExecution(seqFile, "Single Pass", seqModel, false, 0, null, null, null);
            // wait till end
            exec.WaitForEndEx(60 * 1000);   //wait in miliseconds
                
            myEngine.ShutDown(true);
        }

 

 

Message 4 of 4
(2,976 Views)