- Mon Sep 10, 2007 4:56 am
#34899
Hello,
I am very new to Python.
I have a script for sending sms.but it looks some problem in it.
First take my details
Telit module GE 863 GPS (07.02.703)
Python 1.5.2 running on Windows XP.
Here is the script as it is:
import MDM
def SendSMS(phone_number,sms_text):
print 'made it to def'
res = MDM.send('AT+CMGS='+ '9890073045'+ '\r',5)
n=0
while n < 20:
res=MDM.receive(1)
if res.find(">") >-1:
print n
break
else:
n = n +1
res = MDM.send('HELLO DEAR', 10)
if res != -1:
print 'Text sent ok'
res = MDM.sendbyte(0x1a,10)
n=0
while n < 20:
res=MDM.receive(1)
if res.find("+CMGS") >-1:
print n
break
if res.find("ERROR")>-1:
print 'sms ok'
else:
print 'not good'
else:
n = n +1
print 'def completed *******************'
When i run this script, in my debug window i can see only the Python prompt (>>>), Nothing Else....
& at the bottom in the toolbar it shows "returned exit code 0."
No even print statements are get printed.
What's wrong???
Soory if this question seems silly but i am really very new to python...
Please suggest.or give anather code
Regards,
Prashant
I am very new to Python.
I have a script for sending sms.but it looks some problem in it.
First take my details
Telit module GE 863 GPS (07.02.703)
Python 1.5.2 running on Windows XP.
Here is the script as it is:
import MDM
def SendSMS(phone_number,sms_text):
print 'made it to def'
res = MDM.send('AT+CMGS='+ '9890073045'+ '\r',5)
n=0
while n < 20:
res=MDM.receive(1)
if res.find(">") >-1:
print n
break
else:
n = n +1
res = MDM.send('HELLO DEAR', 10)
if res != -1:
print 'Text sent ok'
res = MDM.sendbyte(0x1a,10)
n=0
while n < 20:
res=MDM.receive(1)
if res.find("+CMGS") >-1:
print n
break
if res.find("ERROR")>-1:
print 'sms ok'
else:
print 'not good'
else:
n = n +1
print 'def completed *******************'
When i run this script, in my debug window i can see only the Python prompt (>>>), Nothing Else....
& at the bottom in the toolbar it shows "returned exit code 0."
No even print statements are get printed.
What's wrong???
Soory if this question seems silly but i am really very new to python...
Please suggest.or give anather code
Regards,
Prashant
Thanks & Regards,
Prashant Bhangre
Prashant Bhangre