473,550 Members | 2,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help regarding the "NameError: MOD"

2 New Member
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
  3. The script lists all the sms stored in the memory
  4. """
  6. # import the built-in modules
  7. import MDM
  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)
  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'
  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!
  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.
Sep 10 '07 #1
1 2190
6,596 Recognized Expert Expert
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

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 interactively: When a new module is imported, I'd like the path to the file providing the module to be printed out to the screen. If the module is...
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 becomes a different operation than with regular strings because the circular string can be "rotated", like this: 1 2 3 4 5 2 3 4 5 1 3 4 5 1 2 4 5 1...
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 call last): File "<stdin>", line 1, in ? NameError
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 ..php file is try to create a class of type <filenameminus the .php, so eg. for testmodule.php it tries to create a class "testmodule" and puts it...
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 the data at every 5 minutes.) I proposed using the "mod" function in a WHERE statement on the seconds "datepart" to test if each datapoint is an...
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 a bunch of "unresolved external symbol _imp_FtpFindFirstFileA@20.......blah blah." errors. Can someone explain why this is happening and how to fix...
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 surrendered to you. <%@ Language=VBScript%> <%Option Explicit%>
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> Traceback (most recent call last): File "./Main.py", line 7, in <module> print (t.getAtomName()) File...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.