You Are Here:

Community: Developer Discussion Boards

#1 Old Exclamation getting error while reading inbox - 2009-03-07, 09:06

Join Date: Feb 2009
Posts: 13
itmediaconnect's Avatar
itmediaconnect
Offline
Registered User
Hi,

I'm trying to read unread messages from the Inbox, my code snippet is this:
Code:
import appuifw
import e32
import thread
import messaging,string
import inbox
import contacts  
 
def getsender():
    while(1):
        box=inbox.Inbox()
        id=box.sms_messages()
        for item in id:
            if box.unread(item):
                b=box.content(item)
                sender = box.address(item)     # senders name or number
                mobileNum = getSenderNum(sender)
                print mobileNum
I'm getting this error:
box=inbox.Inbox()
NameError: global name inbox is not defined.

Please help me identify te problem here.


Thanks and Regards
Neeraj
Reply With Quote

#2 Old Re: getting error while reading inbox - 2009-03-07, 09:17

Join Date: Oct 2007
Posts: 2,841
Location: Deva, Romania
bogdan.galiceanu's Avatar
bogdan.galiceanu
Offline
Forum Nokia Champion
Hi,

Please post the entire code you're using. The function getSenderNum is not defined anywhere and the function getsender is only defined, not called.
Reply With Quote

#3 Old Question Re: getting error while reading inbox - 2009-03-07, 23:01

Join Date: Feb 2009
Posts: 13
itmediaconnect's Avatar
itmediaconnect
Offline
Registered User
This is the complete code:
Code:
import appuifw
import e32
import thread
import messaging,string
import inbox
import contacts           #import contact db

db = contacts.open()   #store in a variable "db"

def getSenderNum(sms_sender): 
	found = db.find(sms_sender)   #find in database the contact name
	try: found                   #check if found
	except NameError:
		senderData = found[0]
		senderNum = senderData.find("mobile_number")[0].value
	else:
		senderNum = sms_sender
	
	return senderNum   

#now all you have to do is assign a variable the number of that contact name

def getsender():
    while(1):
        box=inbox.Inbox()
        id=box.sms_messages()
        for item in id:
            if box.unread(item):
                b=box.content(item)
                sender = box.address(item)     # senders name or number
                mobileNum = getSenderNum(sender)
                print mobileNum

thread.start_new_thread(getsender, ())
I'm importing the messaging and inbox libraries, so I expect that inbox would be recognized but thats not happening??


Thanks and Regards
Neeraj
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in Reading sms from inbox venkatesh.pampana General Symbian C++ 2 2008-10-29 14:04
Reading Messages from the inbox mottaisami Mobile Java Networking & Messaging & Security 2 2007-02-01 12:19
S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? www_peach Symbian Networking & Messaging 8 2006-02-01 03:57
S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? www_peach General Symbian C++ 0 2005-09-20 04:58
S60 - C++ - Socket Client - Reading SMS in Binay from InBox and Write to a socket? www_peach Mobile Java Networking & Messaging & Security 0 2005-09-20 04:56

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia