Telegram control Arduino Yun

I want control my Arduino Yun with Telegram App

but i have some error

here is my code

for assistant_edit.py

#!/usr/bin/python
import telepot
import time
import serial
import sys
ser = serial.Serial(’/dev/ttyATH0’,115200)

def handle(msg):

userName = msg[‘from’][‘first_name’]+" "+msg[‘from’][‘last_name’]

content_type, chat_type, chat_id = telepot.glance2(msg)

if (content_type == ‘text’):
command = msg[‘text’]
print (‘Got command: %s’ % command)

if ‘/halo’ in command:
bot.sendMessage(chat_id, “Halo, Master “+userName+”, Ada perintah untuk saya?”)

if ‘/foto’ in command:
ser.write(b’P’)
bot.sendMessage(chat_id, “Foto Sudah Diambil”)

Create a bot using the token given by BotFather

bot = telepot.Bot(‘206695485:AAHHM9M0DwcUMPVrGv5CJ0XXXXXXXXXXX’)

Add handle function to be called every received message.

bot.notifyOnMessage(handle)

Wait for new messages

while 1:
time.sleep(20)

for foto.ino

#include <Bridge.h>
#include <Process.h>
unsigned int data;

void takePicture() {
Process p; // Create a new process
p.begin(“fswebcam”); // Run the fswebcam utility, but first…
p.addParameter("/foto/pic.jpg"); // add a path parameter
p.addParameter("-r 1280x720"); // and a resolution parameter
p.run(); // now run it and and wait for its termination
}

void uploadPicture() {
Process p;
p.begin(“python”);
p.addParameter("/upload-to-dropbox.py");
p.run();
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Bridge.begin();
}

void loop() {
while(Serial.available()>0){
data=Serial.read();
if(data==‘P’) {
takePicture();
uploadPicture();
}

}}

and when i run assistant_edit.py and type /foto form my telegram

in arduino yun here some error

Got command: /foto
Traceback (most recent call last):
File “/usr/lib/python2.7/site-packages/telepot-6.8-py2.7.egg/telepot/init.py”, line 338, in handle
callback(update[‘message’])
File “assistant_edit.py”, line 22, in handle
ser.write(b’P’)
File “/usr/lib/python2.7/site-packages/serial/serialposix.py”, line 547, in write
raise SerialException(‘write failed: %s’ % (v,))
SerialException: write failed: [Errno 5] Input/output error
SerialException: write failed: [Errno 5] Input/output error
^CTraceback (most recent call last):
File “assistant_edit.py”, line 35, in
time.sleep(20)
KeyboardInterrupt

can someone help me ?