Go Down

Topic: MOVED TO YUN: Using Process.runShellCommand to start Python Program (Read 837 times) previous topic - next topic


Mar 12, 2014, 04:26 am Last Edit: Mar 12, 2014, 04:29 am by chriddyplz Reason: 1
Moved to the Yun forum: http://forum.arduino.cc/index.php?topic=225229.0

Hi all --
I'm trying to start a python program on the Linino from the Arduino. This is what I've got:

Arduino Code
Code: [Select]

#include <Process.h>

void setup() {
 Bridge.begin();   // Initialize the Bridge
 Serial.begin(9600);   // Initialize the Serial

 Process p;


 // do nothing until the process finishes, so you get the whole output:
 while (p.running()){ ; }

 while (p.available()) { ; }

void loop() { }

On the Linino, in a file called run_my_python.sh in /root:
Code: [Select]

python /root/my_python_program.py

On the Linino, in a file called my_python_program.py in /root:
Code: [Select]

import os
os.system('touch /root/touched')

When I run
Code: [Select]

$ /root/run_my_python.sh

in the terminal, a file in /root named `touched` successfully gets created. However, when I run this from the Arduino, no file gets created. What am I doing wrong?

Perhaps this is related to some other issues I observed with runShellCommand, here: http://forum.arduino.cc/index.php?topic=225205.0

Thanks a bunch!

Go Up