LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sys exec in while loop

Hi,  

  I I have an application where I call a python script within a while loop using the "System Exec.vi" that communicates with a piece of hardware. Each iteration of the loop feeds a different number to the standard input of "System Exec.vi" which is then passed on the hardware. The python script imports several modules which end up taking about half a second, and the rest of the script executes very quickly. When running the script from the terminal, the preamble executes once and the rest of the script (within a while loop of the python script) loops. When running it from Labview, the entire script executes within the while loop and then seems to close. This becomes a problem because I would like the Labview while loop to execute in ~500ms, which is the entire time that the import commands in the python script take to run. It does not seem that I can have a separate System_exec outside of the Labview while loop that just imports the modules, since this occurs in a different terminal and labview then opens a new session for the System_exec within the while loop. Is there any way around this? I essentially want a way that the terminal within the while loop stays open and I do not have to reimport the modules during every iteration. NI4.vi is what I would like to work, and NI3.vi is another option I tried that also does not work.

Download All
0 Kudos
Message 1 of 4
(3,073 Views)

Just saying that LabVIEW 2018 has python functions. Not sure if it would make a difference.

(Sorry, I don't use Python, so no specific help)

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

You might try using .NET to make the call.  It may give you more control over the process.  Same as Altenbach, I have no experience doing this so I can't give you any help.

https://stackoverflow.com/questions/691716/running-cmd-commands-via-net

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 4
(3,032 Views)

Did it work? I'm having the same problem.

0 Kudos
Message 4 of 4
(2,816 Views)