02-26-2020 03:51 PM
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
02-26-2020 07:54 PM
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 ?
Thanks
Ricky
02-26-2020 10:08 PM
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?
04-22-2020 06:22 AM
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);
}