I am very new to Python.
I am writing a script to ListSMS for my Telit GE863GPS Module.
I have Python1.5.2. on Window XP.
I am getting an error when i run the script.
Here is the whole script.
Expand|Select|Wrap|Line Numbers
- """ Telit - List SMS - Example
- The script lists all the sms stored in the memory
- """
- # import the built-in modules
- import MDM
- #Iinitialize
- res = MDM.send('AT+CMGF=1\r', 0)
- res = MDM.receive(5)
- res = MDM.send('AT+CNMI=2,1\r', 0)
- res = MDM.receive(5)
- #SIM status control - to avoid the 'sim busy' error
- print 'SIM Verification Cycle'
- a = MDM.send ('AT+CPBS?\r', 0)
- SIM_status = MDM.receive(10)
- if SIM_status.find("+CPBS")<0:
- print 'SIM busy! Please wait!\n'
- while SIM_status.find("+CPBS:")< 0 :
- a = MDM.send ('AT+CPBS?\r', 0)
- SIM_status = MDM.receive(10)
- MOD.sleep(2)
- print 'SIM Ready'
- #receive the list of all sms
- MDM.send('AT+CMGL="ALL"\r',0)
- smslist=''
- res = MDM.receive(20)
- smslist = smslist + res
- while res != '':
- res = MDM.receive(20)
- smslist = smslist + res
- print smslist
Expand|Select|Wrap|Line Numbers
- >>> SIM Verification Cycle
- SIM busy! Please wait!
- Traceback (innermost last):
- File "D:\Program Files\Python\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript
- exec codeObject in __main__.__dict__
- File "D:\DOCUME~1\snehal\Desktop\PRASHA~1\Codes\ListSMS1.py", line 20, in ?
- MOD.sleep(2)
- NameError: MOD
- >>>
So i dont know why the error is.
I also tried - import MOD
But when i run the program hangs.
Please suggest proper solution.
THANKS....