473,320 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 2178
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

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

Similar topics

1
by: Steve Juranich | last post by:
First of all, just let me say that I'm aware of the "-v" switch for Python, and I don't want anything nearly that verbose. I often long for the following behavior from Python when I'm running...
23
by: Rogers | last post by:
I want to compare strings of numbers that have a circular boundary condition. This means that the string is arranged in a loop without an end-of-string. The comparaison of two strings now...
45
by: Gregory Petrosyan | last post by:
1) From 2.4.2 documentation: There are two new valid (semantic) forms for the raise statement: raise Class, instance raise instance 2) In python: >>> raise NameError Traceback (most recent...
2
by: Tyno Gendo | last post by:
I'm writing a test "modular site". So far I have created an App class, a Module Manager class and a couple of test modules. The Manager looks in a directory called 'modules' and then for every...
4
by: jonceramic | last post by:
Hi guys, I have a user who wants to have a report that shows only the 10th value recorded by his equipment. (i.e. His equipment records temperature every 30 seconds, but he only wants to view...
8
by: amievil | last post by:
Hello. I'm devloping MFC program and found something weird happening. When I compile it with "debug mode", it compile fine, and runs fine. however, when I compile with "release mode", I get...
7
vikas251074
by: vikas251074 | last post by:
I am getting error above in following code since few days giving tension day and night. How can I solve this? I am facing since Oct.25. in line no. 362 After doing a lot of homework, I am...
4
by: jorgejch | last post by:
Hello, I've started with python (3) recently. Initialy only for scripting. Now I'm trying the object oriented bit. I'm getting the following error message <Atom.Atom object at 0x7f0b09597fd0>...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.