Python script called by Process never end

Hi guys,

I am trying to execute a python script through Process.runShellCommand... It does successfully executed but the script never return any data from doing:

        while(p2.available())
        {
          output2 += (char)p2.read();
        }
        Serial.println(output2);

So the sketch is blocked by the script calling and it cannot continue to execute the following sentences. Here I leave to you the sketch code (a part of it) and the python script code:

sketch.ino

        Process p2;
        p2.begin("/usr/bin/python");
        p2.addParameter("/mnt/sda1/webexample/sendLogTempByMail.py");
        //following parameters are some sensor temperature values 
        p2.addParameter("25.75");
        p2.addParameter("25.00");
        p2.addParameter("25.25");
        p2.run();
        String output2 = "";
        while(p2.available())
        {
          output2 += (char)p2.read();
        }
        Serial.println(output2);

sendLogTempByMail.py

from datetime import datetime
import smtplib, sys
from email.mime.text import MIMEText

degree = u"\u2103"

USERNAME = "arturofelixchari@gmail.com"
PASSWORD = "mypasswd"

MAILTO = ''

with open('/mnt/sda1/webexample/admin_emails.config') as data:
    datalines = (line.rstrip('\n') for line in data)
    for line in datalines:
        MAILTO += line
        MAILTO += ', '

MAILTO = MAILTO[:-2]

msg = MIMEText('Temp. at S1 = '+str(sys.argv[1])+' '+degree.encode("utf-8")+'\nTemp. at S2 = '+str(sys.argv[2])+' '+degree.encode("utf-8")+'\nTemp. at S3 = '+str(sys.argv[3])+' '+degree.encode("utf-8"))
                                                                                                                                                                                                                                                    
msg['Subject'] = 'TempLog ['+datetime.now().strftime('%Y-%m-%d %H:%M:%S')+']'
msg['From'] = USERNAME
msg['To'] = MAILTO    

server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo_or_helo_if_needed()
server.starttls()
server.ehlo_or_helo_if_needed()
server.login(USERNAME,PASSWORD)
server.sendmail(USERNAME, MAILTO.split(","), msg.as_string())
server.quit()

Thanks in advance for any suggestion or correction, Regards.

Arthur.

What are you running this on? This is an Arduino forum you know.

Hi Grumpy Mike,

I am running this on Arduino Yun board. Sorry for forgetting that information.

Regards. Arthur.

I am running this on Arduino Yun board.

Then, you should be asking in the Yun part of the forum.

Yes, I was wrong to post this topic here.

Sorry!

Regards.