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 11
(5,445 Views)
Solution
Accepted by 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 11
(5,433 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 11
(5,418 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 11
(5,384 Views)

1640512762597.jpg

 我也遇到了同样的问题,不知道怎么解决,教教我。

0 Kudos
Message 5 of 11
(5,112 Views)

成功解决了,花了一整天时间,目前似乎只有这一种方法在rpi中调python

0 Kudos
Message 6 of 11
(5,096 Views)

你做了什么来修复它? 发布您的解决方案!

0 Kudos
Message 7 of 11
(5,092 Views)

@毛卫 wrote:

成功解决了,花了一整天时间,目前似乎只有这一种方法在rpi中调python


What was your issue?  It sounds like you are saying your issue is with the Raspberry Pi and not LabVIEW LINX.  You may want to start your own post if it is not released to this topic.

David Wilt
The New Standard LLC
0 Kudos
Message 8 of 11
(5,080 Views)

Dear David,

  thanks for your solution, I follow you mentioned method has successfull

 

0 Kudos
Message 9 of 11
(5,061 Views)

按David提到的网址解决的

0 Kudos
Message 10 of 11
(5,060 Views)