From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Responding to prompts from python script with labview

Hi,

I am trying to communicate with the python script through Labview. Basically, the Python scripts prompts to enter some text, for example name in this sample script. I am using a sample vi i found through white papers. I am not sure how to modify to reply back to the prompt from the python script. 

I have attached the sample vi and the sample script. Any help would be appreciated. I am new to Python with Labview and I am using Labview 2014.


Thanks

manny

Download All
0 Kudos
Message 1 of 4
(2,695 Views)

Manny,

 

When running python in LabVIEW, there are a few things to consider. 

So the system exec vi basically goes to the command prompt and runs your python script. This program currently takes what is on the command line control and passes it to your python script.  So there is not currently a way to interact with it beyond what you initially pass it. So if you want to interact with your python script, you would need to code that interaction into your python script and then call it. 

 

Using LabVIEW and python together is relatively a new process, so if you are going to be doing more complicated python coding I would recommend LabVIEW 2018, since it is compatible with the python node. This essentially treats your python script like a .dll 

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

Thanks for the reply PahlM.

I didnt want to buy Labview 2018 just for this application. Is there some work around. Basically, I want to send a command back to the command window prompt. I want to have continuous interaction with the command prompt window and labview. Any suggestions?


Thanks

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

Manny,

 

If you are interacting with the command prompt window through LabVIEW with a python script, then you will have to build that into your python code. LabVIEW will simply run the script once the way you have it set up. You could try to continuously call the script in LabVIEW, but you are simply inputting parameters to it so I don't think that will be as interactive as you want. It would be best to code that in python and then call that script.

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