×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    16

    Error in using Inbox module

    I tried to make an application that take a repetitive photo in certain period and there is also an option to send the photo command via sms.
    everything works well, except the sms part.
    python wont allow me to use the Inbox module and everytime the program reached the 'teks = i.content(id)' line, it raised an error message saying something like "KerrAccessDenied"
    the code is as follows:

    Code:
    import appuifw, e32
    import camera
    #import socket
    from ftplib import FTP
    from graphics import Image
    import inbox
    import messaging
    import contacts
    
    jalan = 1
    img = Image.new((208,208))
    teks = ''
    i = None
    i = inbox.Inbox()
    global rxsms
    rxsms = 0
    global alamat
    alamat = ''
    global psn
    psn = "Makacih dah ngirim sms ke sini"
    
    def _raw_input(txt):
    	return appuifw.query( unicode( txt ), "text" )
    
    def berhenti():
        global jalan
        jalan = 0
        kunci.signal()
        
    
    def ambil_nomor(alm):
    	db = contacts.open()
    	try:
    		global alamat
    		alamat = db.find(alm)[0].find('mobile_number')[0].value		
    	except:
    		appuifw.note(u"si %s tidak punya nomor henpon!" % alm,"error")
    
    
    def baca_sms(id):
        e32.ao_sleep(0.1)
        global teks, rxsms, alamat
        teks = i.content(id)
        if i.address(id)[0:1] == '+':
        	alamat = i.address(id)
        else:
        	ambil_nomor(i.address(id))
        alamat = i.address(id)
        appuifw.note(u"sms content: " + teks , "info")
        if teks == u"rxphoto":
            rxsms = 1
            
    def kirim_sms(nomor, pesan):
    	messaging.sms_send(nomor, pesan)
    
    def handle_redraw(rect):
    	canvas.blit(img)
    
    def aplod(gambar):    
        ftp = FTP('www.pradana-satyajaya.com')
        ftp.set_pasv('true')
        ftp.login('pradan03','teoteblung')
        ftp.cwd('public_html/images')
        F=open(gambar,'r')
        ftp.storbinary('STOR rxradar.jpg',F,1024)
        ftp.quit()
        F.close()
    
    def jalankan():
    	appuifw.note(u"Coba-coba bikin kamera otomatis", "info" )
    	e32.ao_sleep(1)
    
    	interval=int( _raw_input("Masukkan interval dalam detik: ") )	
    
    	jeda=0
    	lokasi = (u"e:\\images\\roxtars\\radar.jpg")
    	global rxsms,psn
    
    	while jeda<>interval and jalan==1:
    		e32.ao_yield()
    		# coba preview foto
    		gbl = camera.take_photo(size=(640,480))
    		img.blit(gbl,target=(8,10,200,195),scale=1)
    		handle_redraw(())
    		e32.ao_yield()
    		# akhir preview foto
    		
    		# coba pake sms interface		
    		if rxsms == 1:
    			appuifw.note(u"Membalas sms ke %s" % alamat,"info")
    			try:
    				kirim_sms(alamat, psn)
    			except:
    				appuifw.note(u"Tidak bisa mbalas SMS","error")
    		rxsms = 0
    		alamat = ''
    		# akhir sms interface
    		
    		e32.ao_sleep(1)
    		jeda+=1
    		while interval==jeda and jalan==1:
    			appuifw.note(u"Mengambil gambar", "info" )
    			data = camera.take_photo(size=(640,480))
    			appuifw.note(u"Menyimpan gambar", "info" )
    			data.save(lokasi)
    			e32.ao_yield()
    			appuifw.note(u"Mengunggah gambar", "info" )
    			aplod(lokasi)
    			appuifw.note(u"Selesai mengunggah gambar", "info" )
    			jeda = 0	
    
    def jalan_manual():
    	appuifw.note(u"Ini kamera dan upload manual", "info" )
    	e32.ao_sleep(1)	
    	lokasi2 = (u"e:\\images\\roxtars\\radar.jpg")
    	data = camera.take_photo(size=(640,480))
    	data.save(lokasi2)
    	e32.ao_yield()
    	aplod(lokasi2)
    		
    canvas = appuifw.Canvas(redraw_callback=handle_redraw)
    i.bind(baca_sms)
    appuifw.app.body = canvas
    #appuifw.app.screen = 'full'
    appuifw.app.screen = 'large'
    appuifw.app.title=u"Kameraku"
    kunci = e32.Ao_lock()
    appuifw.app.menu = [(u"Otomatis", jalankan),(u"Manual",jalan_manual),(u"Berhenti",berhenti)]
    kunci.wait()
    anybody got a hint on this?

    ~azmi

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,795

    Re: Error in using Inbox module

    Where is ftplib.py?


    -Pankaj Nathani

  3. #3
    Registered User
    Join Date
    Jul 2007
    Posts
    16

    Re: Error in using Inbox module

    Quote Originally Posted by croozeus View Post
    Where is ftplib.py?


    -Pankaj Nathani
    croozeus,
    you can find the ftplib.py at http://www.mobilenin.com/pys60/resources/ftplib.py

  4. #4
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,795

    Re: Error in using Inbox module

    Hello ululazmi

    I added that lib file and executed you code but...Its not clicking pictures also..
    I have executed it on a phone with 2 camera's i.e 6680
    Pankaj Nathani
    www.croozeus.com

  5. #5
    Registered User
    Join Date
    Jul 2007
    Posts
    16

    Re: Error in using Inbox module

    Quote Originally Posted by croozeus View Post
    Hello ululazmi

    I added that lib file and executed you code but...Its not clicking pictures also..
    I have executed it on a phone with 2 camera's i.e 6680
    hi croozeus,
    i used the code on my Nokia 5500 which has only a single camera and works, except the sms part.
    maybe you need to change the code to make it appropriate for your device which has 2 cameras.

  6. #6
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,795

    Re: Error in using Inbox module

    @ululazmi
    Ya right.We have to add the code to specify the camera we are using...I tried your code on 7610 and its working....
    Pankaj Nathani
    www.croozeus.com

Similar Threads

  1. Carbide.j 1.5 and Netbeans 5.5 beta 2
    By ovjo12 in forum Mobile Java Tools & SDKs
    Replies: 5
    Last Post: 2007-06-11, 05:43
  2. loading inbox module
    By sarathgopalr in forum Symbian
    Replies: 4
    Last Post: 2007-06-05, 14:51
  3. strange behaviour with sm inbox module
    By novis in forum Symbian
    Replies: 0
    Last Post: 2007-05-03, 22:23
  4. Adding read/unread status to Inbox module
    By iemorgan in forum Symbian
    Replies: 2
    Last Post: 2006-10-06, 15:02
  5. No module named inbox
    By nibss in forum Symbian
    Replies: 1
    Last Post: 2006-05-31, 00:14

Posting Permissions

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