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 Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Jaime_from_ALMA

Compile LabVIEW VI into Python Script

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

I have been forced to write scripts in Python, a sequential interpreted language.

 

Usually I read variables from sensors in instruments, through CCL, then call a Python script (that usually calls other Python scripts from a library), then the script process thevariables to set parameters in instruments through CCL.

 

What I would love to do is the following:

 

Read the sensor variables through CCL

Input the variables into a Labview diagrammatic program

Call other Python scripts to include as blocks into the diagrammatic program

Upon the processing, generate outputs to set parameters through CCL

 

But also, from Labview, I would like to "export a Python script that does the same process", just to satisfy the managers here and let them feel sure to have new Python scripts that do the same processes.

 

I mean to use Labview to generate Python code, as if "compiling" the diagrammatic program to get a "machine code", even when that "machine" code is just a new interpreted Python script.

 

Just I hate programming in Python, but I must satisfy the managers providing them with new Python scripts to enrich their library.

 

Please tell me if it is possible to use Labview to make diagrammatic programs and then export the equivalent Python script.

 

Also tell me if it is possible to import a Python script from a Labview diagrammatic program, including the imports of other Python scripts, that is to include all libraries.

 

I am really desperate for a solution to this drama.

 

Thank you

 

Jaime Soto

ALMA Observatory, Chile 

5 Comments
TCPlomp
Trusted Enthusiast

You can call python scripts with the LabPython toolkit, however I don't think it's possible to create python code with it.

Since you really dislike python and it seems like it's a core part of your job, you might need to consider the job you have.

 

Ton

 

PS what is CCL

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
G-Money
NI Employee (retired)
Status changed to: New
 
G-Money
NI Employee (retired)

I have changed the title of this idea to "Compile LabVIEW VI to Python Script" to better encompass the overall idea. If you are looking for ways to interact with Python in LabVIEW currently then you might want to post to the discussion forums (ni.com/forums) and see what other users have done. I think the idea of compiling a VI into Python is a valid request for the Idea Exchange though so I am going to leave it.

mzaleski
Member

I'm someone that can code in both LabVIEW and Python and I like both languages when used in appropriate contexts.  I doubt NI can achieve what you are asking for without massive amounts of effort.  G is a dataflow language and Python is a traditional sequential language.

 

I have to echo Ton's comment: If you are not happy with Python, switch jobs.  It sounds like your management wants a solid CPython stack for all of their data collection and analysis.

 

That being said, you can go in the other direction and drive LabVIEW from Python.  Given that LabWindows/CVI is Ansi C, you can directly interface to it from CPython.  You could write portions of the code in LabVIEW and access it those routines with Python.  You can also use the Application Builder Toolkit to create DLLs from VIs for use in the Python scripts.

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.