open .vi file from Python under Linux
|
|
---|---|
Hello everyone! I'm using: - Ubuntu 16.04 - Python 3.5.2 - LabVIEW 2017 I would like to open a .vi file in Python and do something with it, for example manipulate control values in the LabView file or something like that. There is a solution to this for Windows, the "win32com" library. https://stackoverflow.com/questions/3524479/how-to-control-labview-vi-front-panel-switches-on-off-bar-adjuster-using-pyth However win32com library is not available on Linux, so I'm stuck here. Do you have a solution on how to open .vi files in Python under Linux? |
|
|
---|---|
Hi, I don't know what is your exact use case but the recommended solutions would be to: 1. embed a Tango device service into your Labview application then control it remotely from Python (i.e. using PyTango). 2. use a classical client/server socket approach to control your LabVIEW app. |
|
|
---|---|
Unfortunatelly it's forbidden to modify the LabView application, I cannot remove or add any new element to it. Therefore I cannot use your binding solution here. I must reach the .vi file "from the top", by opening the whole file (like in the solution mentioned above) but from Linux. Is there a solution to this? Or alternatively can you tell me about the structure of the .vi files, so maybe I could write a python solution to open the .vi and read/write its elements. Any help or suggestion is appreciated that moves the case forward! |
|
|
---|---|
As far as you can't modify the LabVIEW app, I really don't see how you could implement such a feature. Sorry, but I can't help you more than I did. |
|
|
---|---|
I take that you don't just need to "open". For that you could launch labview path/to/my.vi as a shell command. Probably you want to query the value of some FP indicator and change the value of some FP control. If you can at least add a VI to your same application instance, you may get there by VI server methods. For instance you can augment your application with one VI which listens to incoming string commands on some UDP port, and changes accordingly the controls of some FP of some other VI in memory. Python would handle the UDP communication on its side. If it helps, I have this old snippet of mine lying around. |
|
|
---|---|
Came up today on LAVA, haven't tried. https://lavag.org/topic/20519-testscript-free-pythonlabview-connector/#comment-124834 |
|
|
---|---|
Thanks Enrico. This could be useful later, but for now win32com library is also working for me (first comment). win32com can open and modify elements on the .vi's front panel from python without any modifications to the .vi file! The downside is that the usage is quite limited, and only available on windows. |