You Are Here:

Community: Developer Discussion Boards

#1 Old Error in using Inbox module - 2007-09-13, 08:03

Join Date: Jul 2007
Posts: 16
ululazmi
Offline
Registered User
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
Reply With Quote

#2 Old Re: Error in using Inbox module - 2007-09-17, 11:27

Join Date: May 2007
Posts: 2,739
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
Where is ftplib.py?


-Pankaj Nathani
Reply With Quote

#3 Old Re: Error in using Inbox module - 2007-09-18, 06:10

Join Date: Jul 2007
Posts: 16
ululazmi
Offline
Registered User
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
Reply With Quote

#4 Old Re: Error in using Inbox module - 2007-09-21, 13:42

Join Date: May 2007
Posts: 2,739
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
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
Reply With Quote

#5 Old Re: Error in using Inbox module - 2007-09-23, 05:58

Join Date: Jul 2007
Posts: 16
ululazmi
Offline
Registered User
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.
Reply With Quote

#6 Old Re: Error in using Inbox module - 2007-09-23, 07:22

Join Date: May 2007
Posts: 2,739
Location: 21.46 N 72.11 E
croozeus's Avatar
croozeus
Offline
Forum Nokia Champion
@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....
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
Carbide.j 1.5 and Netbeans 5.5 beta 2 ovjo12 Mobile Java Tools & SDKs 5 2007-06-11 06:43
loading inbox module sarathgopalr Python 4 2007-06-05 15:51
strange behaviour with sm inbox module novis Python 0 2007-05-03 23:23
Adding read/unread status to Inbox module iemorgan Python 2 2006-10-06 16:02
No module named inbox nibss Python 1 2006-05-31 01:14

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