471,337 Members | 1,091 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Help regarding the "NameError: MOD"

Hello,
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
  1. """ Telit - List SMS - Example
  2.  
  3. The script lists all the sms stored in the memory
  4. """
  5.  
  6. # import the built-in modules
  7. import MDM
  8.  
  9. #Iinitialize
  10. res = MDM.send('AT+CMGF=1\r', 0)
  11. res = MDM.receive(5)
  12. res = MDM.send('AT+CNMI=2,1\r', 0)
  13. res = MDM.receive(5)
  14.  
  15. #SIM status control - to avoid the 'sim busy' error
  16. print 'SIM Verification Cycle'
  17. a = MDM.send ('AT+CPBS?\r', 0)
  18. SIM_status = MDM.receive(10)
  19. if SIM_status.find("+CPBS")<0:
  20.     print 'SIM busy! Please wait!\n'
  21. while SIM_status.find("+CPBS:")< 0 :
  22.     a = MDM.send ('AT+CPBS?\r', 0)
  23.     SIM_status = MDM.receive(10)
  24.     MOD.sleep(2)   
  25. print 'SIM Ready'
  26.  
  27. #receive the list of all sms
  28. MDM.send('AT+CMGL="ALL"\r',0)
  29. smslist=''
  30. res = MDM.receive(20)
  31. smslist = smslist + res
  32. while res != '':
  33.     res = MDM.receive(20)
  34.     smslist = smslist + res
  35. print smslist
When i run this script in my debug window i can see the following message.

Expand|Select|Wrap|Line Numbers
  1. >>> SIM Verification Cycle
  2. SIM busy! Please wait!
  3.  
  4. Traceback (innermost last):
  5.   File "D:\Program Files\Python\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript
  6.     exec codeObject in __main__.__dict__
  7.   File "D:\DOCUME~1\snehal\Desktop\PRASHA~1\Codes\ListSMS1.py", line 20, in ?
  8.     MOD.sleep(2)
  9. NameError: MOD
  10. >>> 
I am very new to Python.
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....
Sep 10 '07 #1
1 2064
bartonc
6,596 Expert 4TB
There are several possibilities. Most likely:
Expand|Select|Wrap|Line Numbers
  1. import time
  2. #.....#
  3. #
  4.     time.sleep(2)
But since it looks like "MDM", I'm thinking that maybe that module has a sleep function:
Expand|Select|Wrap|Line Numbers
  1. #
  2. #
  3.     MDM.sleep(2)
Sep 10 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Steve Juranich | last post: by
45 posts views Thread by Gregory Petrosyan | last post: by
4 posts views Thread by jonceramic | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.