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…
busonerd:
SendSMS is a function, from what I can see, you’re never calling it.
Cheers,
–David Carne
Hello,
Now i am using this script, it should work fine.But it is not.
import MDM import MOD #import SendSMS def SendSMS(phone_number,sms_text):
phone_number=‘9890073045’ sms_text =‘HELLO DEAR’ #MOD.sleep (200) #SendSMS(‘9890073045’,‘HELLO DEAR’) 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 *******************’
Now when i run it it runs fine with no error.ALL Print statements GETS PRINTED.But when i connect virtual port to my hyperterm, it shows syntax error, no statement gets printed.
How is this please suggest.Do i need to call this script from another script(By just importing it.)