Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

Run python script in LabVIEW LINX

Solved!
Go to solution

Hello all,

 

I need to run a python script that is stored on my raspberry pi.

In my LabVIEW code I am using the system exec vi and passing it the command python3 \home\pi\test.py.

Goomba79_0-1629992456156.png

however this isn't working. the standard error out put of the system exec vi out puts the following:

/bin/sh: python3: command not found

 

has anyone had any luck with getting a python script to run on a pi when called by Labview?

 

Thanks for looking,

 

Iain 

 

 

0 Kudos
Message 1 of 4
(301 Views)
Solution
Accepted by topic author Goomba79

I have not specifically tried to run Python code from LabVIEW code on the Raspberry Pi but I assume that you are having a pathing issue.  Also, Python is not installed in the LabVIEW location so you might have issue running it from there even if you don't have a pathing issue.

 

My thought would be to run the code from the Raspberry Pi OS and send an ssh command from LabVIEW to run it.  Now while you will be able to run the code like this I am not sure how well you will be able to change data between the Python code and LabVIEW code this way.

 

Here is an example of what I am doing to run an ssh command from LabVIEW.

 

RPi System Exec.jpg

 

In order to get this all to work you will need Chroot SSH trick and probably Run ‘sudo’ Command Without Entering a Password in Linux.

David Wilt
The New Standard LLC
Message 2 of 4
(289 Views)

Hello David,

 

Thanks for the reply.

I'll have a look at the articles you linked and see if it gets me up and running.

I'll let you know how I get on!

 

Cheers,

 

Iain

0 Kudos
Message 3 of 4
(274 Views)

Hi David,

 

sorry for the delayed reply.

I tried the ssh method you outlined and that it going thanks!

0 Kudos
Message 4 of 4
(240 Views)