There is an easy workaround for me here. Simply timer.sleep(7) after connect() and before sendSms. Just sending this on if is of interest - error output below:
Initializing modem...
INFO: Connecting to modem on port COM9 at 115200bps
DEBUG: write: ATZ
DEBUG: response: ['ATZ\r', 'ERROR']
DEBUG: write: AT+CMEE=1
DEBUG: response: ['AT+CMEE=1\r', 'OK']
DEBUG: write: AT+CPIN?
DEBUG: response: ['AT+CPIN?\r', '+CPIN: SIM PIN', 'OK']
DEBUG: write: AT+CPIN="xxxxx"
DEBUG: response: ['AT+CPIN="xxxxx"\r', 'OK']
DEBUG: write: ATZ
DEBUG: response: ['ATZ\r', 'OK']
DEBUG: write: ATE0
DEBUG: response: ['ATE0\r', 'OK']
DEBUG: write: AT+CFUN?
DEBUG: response: ['+CFUN: 0', 'OK']
DEBUG: write: AT+CFUN=1
DEBUG: response: ['OK']
DEBUG: write: AT+CMEE=1
DEBUG: response: ['OK']
DEBUG: write: AT+CLAC
DEBUG: response: ['ERROR']
DEBUG: write: AT+WIND?
DEBUG: response: ['ERROR']
DEBUG: write: AT+CGMI
DEBUG: response: ['QUALCOMM INCORPORATED', 'OK']
INFO: Unknown modem type - will use polling for call state updates
DEBUG: write: AT+COPS=3,0
DEBUG: response: ['OK']
DEBUG: write: AT+CMGF=1
DEBUG: response: ['OK']
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 1s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: notification: ['+ZDONR: "Not Found"', '+ZPASR: "No Service"']
DEBUG: Unhandled unsolicited modem notification: ['+ZDONR: "Not Found"', '+ZPASR: "No Service"']
DEBUG: 515 error detected; self._writeWait adjusted to 1s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 1s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CSCA: "+353857000000",145', 'OK']
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: write: AT+CSMP=49,167,0,0
DEBUG: response: ['OK']
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CSCA: "+353857000000",145', 'OK']
DEBUG: write: AT+CPMS=?
DEBUG: response: ['+CPMS: ("ME","MT","SM","SR"),("ME","MT","SM","SR"),("ME","MT","SM","SR")', 'OK']
DEBUG: write: AT+CPMS="ME","ME","ME"
DEBUG: response: ['+CPMS: 1,100,1,100,1,100', 'OK']
DEBUG: write: AT+CNMI=2,1,0,2
DEBUG: response: ['OK']
DEBUG: write: AT+CLIP=1
DEBUG: response: ['OK']
DEBUG: write: AT+CRC=1
DEBUG: response: ['OK']
DEBUG: write: AT+CVHU=0
DEBUG: response: ['OK']
Waiting for SMS and/or calls...
DEBUG: write: AT+CMGS="087111111"
DEBUG: response: ['> ']
DEBUG: write: test message
DEBUG: response: ['+CMS ERROR: 500']
Traceback (most recent call last):
File "GSM2.py", line 65, in
main()
File "GSM2.py", line 50, in main
sms = modem.sendSms('087111111', 'test message', waitForDeliveryReport=False)
File "c:\python27\lib\site-packages\gsmmodem\modem.py", line 417, in sendSms
result = self.write(text, timeout=15, writeTerm=chr(26))[0]
File "c:\python27\lib\site-packages\gsmmodem\modem.py", line 266, in write
raise CmsError(data, int(errorCode))
gsmmodem.exceptions.CmsError: CMS 500
However when I put in the sleep, I works successfully as below:
Initializing modem...
INFO: Connecting to modem on port COM9 at 115200bps
DEBUG: write: ATZ
DEBUG: response: ['ATZ\r', 'ERROR']
DEBUG: write: AT+CMEE=1
DEBUG: response: ['AT+CMEE=1\r', 'OK']
DEBUG: write: AT+CPIN?
DEBUG: response: ['AT+CPIN?\r', '+CPIN: SIM PIN', 'OK']
DEBUG: write: AT+CPIN="xxx"
DEBUG: response: ['AT+CPIN="xxx"\r', 'OK']
DEBUG: write: ATZ
DEBUG: response: ['ATZ\r', 'OK']
DEBUG: write: ATE0
DEBUG: response: ['ATE0\r', 'OK']
DEBUG: write: AT+CFUN?
DEBUG: response: ['+CFUN: 0', 'OK']
DEBUG: write: AT+CFUN=1
DEBUG: response: ['OK']
DEBUG: write: AT+CMEE=1
DEBUG: response: ['OK']
DEBUG: write: AT+CLAC
DEBUG: response: ['ERROR']
DEBUG: write: AT+WIND?
DEBUG: response: ['ERROR']
DEBUG: write: AT+CGMI
DEBUG: response: ['QUALCOMM INCORPORATED', 'OK']
INFO: Unknown modem type - will use polling for call state updates
DEBUG: write: AT+COPS=3,0
DEBUG: response: ['OK']
DEBUG: write: AT+CMGF=1
DEBUG: response: ['OK']
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 0s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 1s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: notification: ['+ZDONR: "Not Found"', '+ZPASR: "No Service"']
DEBUG: Unhandled unsolicited modem notification: ['+ZDONR: "Not Found"', '+ZPASR: "No Service"']
DEBUG: 515 error detected; self._writeWait adjusted to 1s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CME ERROR: 14']
DEBUG: 515 error detected; self._writeWait adjusted to 1s
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CSCA: "+353857000000",145', 'OK']
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: self_writeWait set to 0.1 because of recovering from 515 error
DEBUG: write: AT+CSMP=49,167,0,0
DEBUG: response: ['OK']
DEBUG: write: AT+CSCA?
DEBUG: response: ['+CSCA: "+353857000000",145', 'OK']
DEBUG: write: AT+CPMS=?
DEBUG: response: ['+CPMS: ("ME","MT","SM","SR"),("ME","MT","SM","SR"),("ME","MT","SM","SR")', 'OK']
DEBUG: write: AT+CPMS="ME","ME","ME"
DEBUG: response: ['+CPMS: 1,100,1,100,1,100', 'OK']
DEBUG: write: AT+CNMI=2,1,0,2
DEBUG: response: ['OK']
DEBUG: write: AT+CLIP=1
DEBUG: response: ['OK']
DEBUG: write: AT+CRC=1
DEBUG: response: ['OK']
DEBUG: write: AT+CVHU=0
DEBUG: response: ['OK']
Waiting for SMS and/or calls...
DEBUG: notification: ['+ZDONR: "METEOR",272,3,"CS_ONLY","ROAM_OFF"', '+ZPASR: "UMTS"', '+ZDONR: "METEOR",272,3,"CS_ONLY","ROAM_OFF"', '+ZPASR: "UMTS"']
DEBUG: Unhandled unsolicited modem notification: ['+ZDONR: "METEOR",272,3,"CS_ONLY","ROAM_OFF"', '+ZPASR: "UMTS"', '+ZDONR: "METEOR",272,3,"CS_ONLY","ROAM_OFF"'
, '+ZPASR: "UMTS"']
DEBUG: notification: ['+ZDONR: "METEOR",272,3,"CS_PS","ROAM_OFF"', '+ZPASR: "UMTS"']
DEBUG: Unhandled unsolicited modem notification: ['+ZDONR: "METEOR",272,3,"CS_PS","ROAM_OFF"', '+ZPASR: "UMTS"']
DEBUG: write: AT+CMGS="0871111111"
DEBUG: response: ['> ']
DEBUG: write: test message
DEBUG: response: ['+CMGS: 61', 'OK']
Message sent.
DEBUG: notification: ['+CDSI: "SR",50']
DEBUG: SMS status report received
DEBUG: write: AT+CPMS="SR"
DEBUG: response: ['+CPMS: 1,100,2,100,2,100', 'OK']
DEBUG: write: AT+CMGR=50
DEBUG: response: ['+CMGR: ,6,61,"0871111111",129,"13/05/03,14:56:00+04","13/05/03,14:56:00+04",0', 'OK']
DEBUG: write: AT+CMGD=50
DEBUG: response: ['OK']
forgot to say, that you so so much for all the excellent work on this. Its greatly appreciated!