Posts: 1
Joined: Tue Dec 12, 2017 10:11 am

error msg

Tue Dec 12, 2017 10:26 am

Hello guys
im quite new for the python
so i'm using raspberry pi3 model b
and im trying to connect a gsm/gprs sim900 arduino based shield directly to the gpio serial pins 8&10
i tried this this example below :
import serial
import os
import time
ser = serial.Serial ("/dev/ttyUSB0" , 9600 )
response = ser.readlines(None)
response = ser.readlines(None)
response = ser.readlines(None)
ser.write("Hello Raspberry Pi")
ser.close( )

im using python 2.7.13
when i run the module i get this error:
Traceback (most recent call last):
File "/home/pi/Desktop/", line 4, in <module>
ser = serial.Serial ("/dev/ttyUSB0" , 9600 )
File "/usr/lib/python2.7/dist-packages/serial/", line 236, in __init__
File "/usr/lib/python2.7/dist-packages/serial/", line 268, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
SerialException: [Errno 16] could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0'

know that the connection betxeen the gsm and rpi is:
and external power jack providing 6v with current 1A

Hope someone tell me what to do for sending a just one simple sms

User avatar
Posts: 32671
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: error msg

Thu Dec 14, 2017 11:47 am

sudo apt install lsof # if it's not already installed.
sudo lsof /dev/ttyUSB0

That will tell you what process is using the device file.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

Return to “Python”

Who is online

Users browsing this forum: paddyg, samuraihack_ and 16 guests