-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Python Code:
from labview_automation import LabVIEW
vi_path = 'C:\Users\Administrator\Desktop\add.vi'
lv = LabVIEW()
lv.start() # Launches the active LabVIEW with the listener VI
with lv.client() as c:
control_values = {
"a": 2,
"b": 5
}
indicators = c.run_vi_synchronous(
vi_path, control_values)
print(indicators['c'])
#error_message = c.describe_error(indicators['Error Out'])
#lv.kill() # Stop LabVIEW
LVAutomation Listener:
[2019/3/29 9:17:52] (GUID - 5c9cad606465322594000008) Command received.
Message: {
"run_options" : 0,
"indicator_names" : [],
"control_values" : {
"a" : 2,
"b" : 5
},
"vi_path" : "C:\Users\Administrator\Desktop\add.vi",
"command" : "run_vi",
"open_frontpanel" : false
}
[2019/3/29 9:17:52] (GUID - 5c9cad606465322594000008) Command sent successfully.
Message: {
"c" : 7.0000000000,
"RunVIState_Status" : false,
"RunVIState_Code" : 0,
"RunVIState_Source" : ""
}
[2019/3/29 9:17:52] (TCP Connection-5c9cad606465322594000008) Lost
Python Shell:
lv.client().run_vi_synchronous(vi_path, control_values)
Traceback (most recent call last):
File "<pyshell#0>", line 1, in
lv.client().run_vi_synchronous(vi_path, control_values)
File "D:\Python\Python27\lib\site-packages\labview_automation\labview.py", line 175, in client
raise NotStartedError("You must start LabVIEW to get talk to it.")
NotStartedError: You must start LabVIEW to get talk to it.