LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need guidance to add phython script with LV code

Solved!
Go to solution

Hi,

Apologies for disturbing you. I have prepared a LabVIEW (LV) code that currently handles only the data collection part. For data analysis, I am required to run a separate Python script, which makes my entire data processing workflow a two-step process: first, data collection, and second, data analysis.

I am wondering if it is possible to integrate or synchronize the Python script with the LV code so that the entire workflow becomes seamless, with the Python code executing automatically as soon as the data is collected.

I would greatly appreciate your guidance on how to achieve this. Thank you!

 

Hasham

0 Kudos
Message 1 of 10
(328 Views)

I guess, you should start from here: Integrating Python Code in LabVIEW.

Message 2 of 10
(322 Views)

You can call Python functions in LV, so it should be simple.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 3 of 10
(292 Views)

Just one small thing.

If you will pass LabVIEW arrays to the Python Script I would like to recommend to marshal data as numpy arrays, this will decrease "transfer" overhead.

Minimal working example:

Python.png

Some examples in <LabVIEW>\examples\Connectivity\Python\support

Message 4 of 10
(250 Views)

Hasham622x_0-1732875389807.png

Hasham622x_1-1732875426480.pngHasham622x_2-1732875446182.png

Hi,

 

Thanks for your reply. I have phython3.11 version and getting this error. could you please guide me.

 

Kind regards

 

Hasham

 

0 Kudos
Message 5 of 10
(240 Views)

Hasham622x_0-1732877692803.png

 

 

Hasham622x_2-1732877920933.png

 

0 Kudos
Message 6 of 10
(232 Views)
Solution
Accepted by topic author Hasham622x

@Hasham622x wrote:

 

Hi,

 

Thanks for your reply. I have phython3.11 version and getting this error. could you please guide me.

 

Kind regards

 

Hasham

 


Two things - first check your LabVIEW Version and compatible Python from the link above, and be sure that Python bitness the same with LabVIEW (both 32 bit or both 64, but not mixed), then it should work.

---

Screenshot 2024-11-29 12.30.29.png

Message 7 of 10
(227 Views)

 

Hi,

Sorry for the disturbance. I installed Python 3.9 (64-bit) and am currently using LV22 (64-bit). I prepared a sample example, but it gives me an error. Please guide me.

 

kind regards

 

Hasham

 

 

Hasham622x_0-1733915200058.png

Hasham622x_1-1733915220324.png

 

0 Kudos
Message 8 of 10
(148 Views)
Solution
Accepted by topic author Hasham622x

@Hasham622x wrote:

 

Hi,

Sorry for the disturbance. I installed Python 3.9 (64-bit) and am currently using LV22 (64-bit). I prepared a sample example, but it gives me an error. Please guide me.

 

 

 


Path input in Open PYthon Session is not intended for your script, this is path to Python itself, which usually grabbed automatically from registry.

Just try to leave it unconnected:

Andrey_Dmitriev_0-1733918869874.png

 

 

Message 9 of 10
(139 Views)

Hi,

 

Thank you for your reply. It is working as expected.

If you don’t mind, could you kindly guide me on how to add a Python node into my main LabVIEW code? I am currently using the NI 6363 to acquire data from multichannel analog inputs (AI).

If possible, please share any relevant guidance or a solved example for reference.

Thank you for your time and support.

 

Kind regards

 

Hasham

0 Kudos
Message 10 of 10
(64 Views)