2

I need to call a Python script from Labview, someone know which is the best method to do that? I've tried Labpython, but it is not supported on newest versions of Labview and I'm not able to use it on Labview-2014. Definitevly, I'm looking for an advice about python integration: I know this two solutions:

1)Labpython: is a good solution but it is obsolete

2)execute python script with shell_execute block in Labview. I think that it isn't the best solution because is very hard to get the output of python script

Pietro Z.
  • 521
  • 2
  • 6
  • 18
  • Possible duplicate of [send data from LabView to Python and get back](https://stackoverflow.com/questions/6596974/send-data-from-labview-to-python-and-get-back) – Ghanima Aug 07 '18 at 21:14

5 Answers5

2

I think this will be useful: send data from LabView to Python and get back

Also, the easiest way(for me) to communicate with python code from LabVIEW is to send TCP commands from LabVIEW to Python and back.

Community
  • 1
  • 1
Khachik Sahakyan
  • 1,982
  • 15
  • 24
  • I didn't consider TCP solution, can you give me more information please? – Pietro Z. Oct 23 '15 at 14:26
  • The idea is to run python script in python ide itself as a server and write LabVIEW client which will send TCP requests to python script and receive response from python. – Khachik Sahakyan Oct 23 '15 at 19:52
  • Beginning in LabVIEW 2018, there is native support for calling Python modules: http://zone.ni.com/reference/en-XX/help/371361R-01/glang/python_pal/ – Aposhian Apr 16 '19 at 23:17
1

Why not use the System Exec.vi in Connectivity->Libraries and Executables menu?

You can execute the script and get the output.

slacker
  • 66
  • 2
0

Check out TestScript: a free, source-released Python/LabVIEW connector. It's fully bi-directional, including arguments and is compatible with LabVIEW 2013 and later, and Python 3.

Adrian Keister
  • 842
  • 3
  • 15
  • 33
0

You can save Python script as a large string constant(or load from text file) within the LabVIEW vi so that it can be manipulated within LabVIEW and then save that to a text file then execute the Python script using command line in LabVIEW. Python yourscript enter

0

You can use the integrated Python nodes. There are quite simple examples integrated in LabVIEW. Open them via the Help/Find examples... menu, then type Python into the search field and you will find various Python examples such as "PythonNode_AddTwoDoubles.vi".

Be aware that this Python support is only available with (I think) LV2018 or later.

Kyle F Hartzenberg
  • 2,567
  • 3
  • 6
  • 24
Jensolo
  • 49
  • 6