From pdilley at bmm.com Wed May 21 07:03:13 2008 From: pdilley at bmm.com (Peter Dilley) Date: Wed, 21 May 2008 15:03:13 +1000 Subject: [melbourne-pug] Offer to Python User Groups for Python Magazine. Message-ID: <1211346193.1214.1254280155@webmail.messagingengine.com> Fellow group members, Doug Hellman of Python Magazine has informed me of an offer to user groups discussing Python topics. A copy of Doug's offer is posted below (Note: If you choose to accept the offer, remember to use the account you have registered with MelbournePUG): Python Magazine would like to offer free 3 month PDF subscriptions for members of Python user groups. This promotional is open to members of user groups who discuss Python- related topics. To take advantage of the offer, each member of the group should go to our web site (http://www.pythonmagazine.com) and set up an account (that's already free). When they register, the site will ask them for an email address to identify the account. Thanks, Doug -- Doug Hellmann Technical Editor Python Magazine Peter Dilley Compliance Manager, IT System Testing and Security BMM Testlabs Level 3, 810 Whitehorse Road Box Hill, Victoria 3128, Australia Phone: +61 3 9890 5988 Fax: +61 3 9899 6277 Cell: +61 414 324 467 www.bmm.com ---------------------------------------------------------------------------------------------------------- This email, its contents and any attachments ("Email") are confidential and may be privileged. Any unauthorised use, distribution or copying is prohibited. If you have received this Email in error, please immediately contact the Sender. The Sender does not represent or warrant that this Email is free from computer viruses or other defects. This Email may only be used on the basis that the user assumes all responsibility for any resulting loss or damage. In any event, the liability of the Sender is limited to either the resupplying, or the cost of resupplying, this Email. ---------------------------------------------------------------------------------------------------------- From pdilley at bmm.com Thu May 22 03:02:01 2008 From: pdilley at bmm.com (Peter Dilley) Date: Thu, 22 May 2008 11:02:01 +1000 Subject: [melbourne-pug] How to complete Was: Offer to Python User Groups for Python Magazine. In-Reply-To: <1211346193.1214.1254280155@webmail.messagingengine.com> References: <1211346193.1214.1254280155@webmail.messagingengine.com> Message-ID: <1211418121.8843.1254459127@webmail.messagingengine.com> Members, It turns out that Doug is doing all this subscription offer by hand so he has requested just one email of all the addresses of those on the PUG that sign up for an account with Python Magazine. If you sign up and follow the process outlined, just send a mail to myself and I'll add you on to the list. To give everyone a chance to read and decide to accept the free issue offer, I'll put a self imposed deadline on responses of 5th June 2008 (two weeks to decide.) After that time, I will send the final list of those of us who want 3 free PDF issues to Doug to hand process. Cheers, Peter On Wed, 21 May 2008 15:03:13 +1000, "Peter Dilley" said: > Fellow group members, > > Doug Hellman of Python Magazine has informed me of an offer to user > groups discussing Python topics. A copy of Doug's offer is posted below > (Note: If you choose to accept the offer, remember to use the account you > have registered with MelbournePUG): > > > > Python Magazine would like to offer free 3 month PDF subscriptions > for members of Python user groups. > > This promotional is open to members of user groups who discuss Python- > related topics. > > To take advantage of the offer, each member of the group should go to > our web site (http://www.pythonmagazine.com) and set up an account > (that's already free). When they register, the site will ask them for > an email address to identify the account. > > Thanks, > Doug > -- > Doug Hellmann > Technical Editor > Python Magazine From mark.hellewell at gmail.com Thu May 22 03:35:50 2008 From: mark.hellewell at gmail.com (Mark Hellewell) Date: Thu, 22 May 2008 11:35:50 +1000 Subject: [melbourne-pug] How to complete Was: Offer to Python User Groups for Python Magazine. In-Reply-To: <1211418121.8843.1254459127@webmail.messagingengine.com> References: <1211346193.1214.1254280155@webmail.messagingengine.com> <1211418121.8843.1254459127@webmail.messagingengine.com> Message-ID: <853B836C-FB88-4BAF-84B9-80552A85489C@gmail.com> Hi Peter, I've just signed up for an account and would like to accept the free issue offer. I signed up as mark.hellewell at gmail.com Cheers, Mark On 22/05/2008, at 11:02 AM, Peter Dilley wrote: > Members, > > It turns out that Doug is doing all this subscription offer by hand > so he has requested just one email of all the addresses of those on > the PUG that sign up for an account with Python Magazine. > > If you sign up and follow the process outlined, just send a mail to > myself and I'll add you on to the list. > > To give everyone a chance to read and decide to accept the free > issue offer, I'll put a self imposed deadline on responses of 5th > June 2008 (two weeks to decide.) After that time, I will send the > final list of those of us who want 3 free PDF issues to Doug to hand > process. > > Cheers, > Peter From pdilley at bmm.com Thu May 22 03:41:17 2008 From: pdilley at bmm.com (Peter Dilley) Date: Thu, 22 May 2008 11:41:17 +1000 Subject: [melbourne-pug] How to complete Was: Offer to Python User Groups for Python Magazine. In-Reply-To: <853B836C-FB88-4BAF-84B9-80552A85489C@gmail.com> References: <1211346193.1214.1254280155@webmail.messagingengine.com> <1211418121.8843.1254459127@webmail.messagingengine.com> <853B836C-FB88-4BAF-84B9-80552A85489C@gmail.com> Message-ID: <1211420477.15826.1254464003@webmail.messagingengine.com> Mark, No worries, you are now on the list. Cheers, Peter On Thu, 22 May 2008 11:35:50 +1000, "Mark Hellewell" said: > Hi Peter, > > I've just signed up for an account and would like to accept the free > issue offer. > > I signed up as mark.hellewell at gmail.com > > Cheers, > Mark > > On 22/05/2008, at 11:02 AM, Peter Dilley wrote: > > > Members, > > > > It turns out that Doug is doing all this subscription offer by hand > > so he has requested just one email of all the addresses of those on > > the PUG that sign up for an account with Python Magazine. > > > > If you sign up and follow the process outlined, just send a mail to > > myself and I'll add you on to the list. > > > > To give everyone a chance to read and decide to accept the free > > issue offer, I'll put a self imposed deadline on responses of 5th > > June 2008 (two weeks to decide.) After that time, I will send the > > final list of those of us who want 3 free PDF issues to Doug to hand > > process. > > > > Cheers, > > Peter > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug Peter Dilley Compliance Manager, IT System Testing and Security BMM Testlabs Level 3, 810 Whitehorse Road Box Hill, Victoria 3128, Australia Phone: +61 3 9890 5988 Fax: +61 3 9899 6277 Cell: +61 414 324 467 www.bmm.com ---------------------------------------------------------------------------------------------------------- This email, its contents and any attachments ("Email") are confidential and may be privileged. Any unauthorised use, distribution or copying is prohibited. If you have received this Email in error, please immediately contact the Sender. The Sender does not represent or warrant that this Email is free from computer viruses or other defects. This Email may only be used on the basis that the user assumes all responsibility for any resulting loss or damage. In any event, the liability of the Sender is limited to either the resupplying, or the cost of resupplying, this Email. ---------------------------------------------------------------------------------------------------------- From toshiboy at gmail.com Thu May 22 11:17:59 2008 From: toshiboy at gmail.com (ToshiBoy) Date: Thu, 22 May 2008 19:17:59 +1000 Subject: [melbourne-pug] How to complete Was: Offer to Python User Groups for Python Magazine. In-Reply-To: <1211418121.8843.1254459127@webmail.messagingengine.com> References: <1211346193.1214.1254280155@webmail.messagingengine.com> <1211418121.8843.1254459127@webmail.messagingengine.com> Message-ID: <48353A47.2040206@gmail.com> I'm on it as toshiboy at gmail.com :-) Thanks Peter Dilley wrote: > Members, > > It turns out that Doug is doing all this subscription offer by hand so he has requested just one email of all the addresses of those on the PUG that sign up for an account with Python Magazine. > > If you sign up and follow the process outlined, just send a mail to myself and I'll add you on to the list. > > To give everyone a chance to read and decide to accept the free issue offer, I'll put a self imposed deadline on responses of 5th June 2008 (two weeks to decide.) After that time, I will send the final list of those of us who want 3 free PDF issues to Doug to hand process. > > Cheers, > Peter > > > On Wed, 21 May 2008 15:03:13 +1000, "Peter Dilley" said: > >> Fellow group members, >> >> Doug Hellman of Python Magazine has informed me of an offer to user >> groups discussing Python topics. A copy of Doug's offer is posted below >> (Note: If you choose to accept the offer, remember to use the account you >> have registered with MelbournePUG): >> >> >> >> Python Magazine would like to offer free 3 month PDF subscriptions >> for members of Python user groups. >> >> This promotional is open to members of user groups who discuss Python- >> related topics. >> >> To take advantage of the offer, each member of the group should go to >> our web site (http://www.pythonmagazine.com) and set up an account >> (that's already free). When they register, the site will ask them for >> an email address to identify the account. >> >> Thanks, >> Doug >> -- >> Doug Hellmann >> Technical Editor >> Python Magazine >> > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > From g.forumz at gmail.com Thu May 22 21:10:01 2008 From: g.forumz at gmail.com (g sobers) Date: Thu, 22 May 2008 15:10:01 -0400 Subject: [melbourne-pug] Simple syntactic error? Message-ID: G'day! Following is a small PyS60 script. The error seems related to basic syntax - "state" in keys() is not recognized although defined globally. Would appreciate assistance. ============================================= import appuifw, key_codes, e32, telephone state = None def keys(event): if event['keycode'] == key_codes.EKeyYes: appuifw.note(u"Doesn't Matter") elif (event['keycode'] == key_codes.EKeyYes) and (state == telephone.EStatusConnected): appuifw.note(u"Yes was pressed and call active") def cb_calling(args): state = args[0] def quit(): app_lock.signal() telephone.call_state(cb_calling) canvas = appuifw.Canvas(event_callback = keys) appuifw.app.body = canvas appuifw.app.exit_key_handler = quit app_lock = e32.Ao_lock() app_lock.wait() ============================================== Best, wirefree -------------- next part -------------- An HTML attachment was scrubbed... URL: From john.larooy at gmail.com Thu May 22 21:42:57 2008 From: john.larooy at gmail.com (John La Rooy) Date: Fri, 23 May 2008 05:42:57 +1000 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: Message-ID: Are you getting an AttributeError in keys() or is state just None. It looks like cb_calling needs to declare state as global def cb_calling(args): global state state = args[0] On Fri, May 23, 2008 at 5:10 AM, g sobers wrote: > G'day! > > Following is a small PyS60 script. The error seems related to basic syntax > - "state" in keys() is not recognized although defined globally. > > Would appreciate assistance. > > ============================================= > import appuifw, key_codes, e32, telephone > state = None > > def keys(event): > if event['keycode'] == key_codes.EKeyYes: > appuifw.note(u"Doesn't Matter") > elif (event['keycode'] == key_codes.EKeyYes) and (state == > telephone.EStatusConnected): > appuifw.note(u"Yes was pressed and call active") > > def cb_calling(args): > state = args[0] > > def quit(): > app_lock.signal() > > telephone.call_state(cb_calling) > canvas = appuifw.Canvas(event_callback = keys) > appuifw.app.body = canvas > appuifw.app.exit_key_handler = quit > app_lock = e32.Ao_lock() > app_lock.wait() > ============================================== > > Best, > wirefree > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.forumz at gmail.com Thu May 22 21:53:03 2008 From: g.forumz at gmail.com (g sobers) Date: Thu, 22 May 2008 15:53:03 -0400 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: Message-ID: Appreciate the response. *Are you getting an AttributeError in keys() or is state just None.* No errors, per se, are generated. So, state=none seems most likely. * It looks like cb_calling needs to declare state as global ** def cb_calling(args): global state state = args[0] * As regards to your suggestion, I just implemented it - to no avail. Same conditions persist. Where else should I be looking? Best, wirefree On 5/22/08, John La Rooy wrote: > > Are you getting an AttributeError in keys() or is state just None. > It looks like cb_calling needs to declare state as global > > def cb_calling(args): > global state > state = args[0] > > On Fri, May 23, 2008 at 5:10 AM, g sobers wrote: > >> G'day! >> >> Following is a small PyS60 script. The error seems related to basic syntax >> - "state" in keys() is not recognized although defined globally. >> >> Would appreciate assistance. >> >> ============================================= >> import appuifw, key_codes, e32, telephone >> state = None >> >> def keys(event): >> if event['keycode'] == key_codes.EKeyYes: >> appuifw.note(u"Doesn't Matter") >> elif (event['keycode'] == key_codes.EKeyYes) and (state == >> telephone.EStatusConnected): >> appuifw.note(u"Yes was pressed and call active") >> >> def cb_calling(args): >> state = args[0] >> >> def quit(): >> app_lock.signal() >> >> telephone.call_state(cb_calling) >> canvas = appuifw.Canvas(event_callback = keys) >> appuifw.app.body = canvas >> appuifw.app.exit_key_handler = quit >> app_lock = e32.Ao_lock() >> app_lock.wait() >> ============================================== >> >> Best, >> wirefree >> >> _______________________________________________ >> melbourne-pug mailing list >> melbourne-pug at python.org >> http://mail.python.org/mailman/listinfo/melbourne-pug >> >> > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From darius at obsidian.com.au Fri May 23 00:53:01 2008 From: darius at obsidian.com.au (Kevin Littlejohn) Date: Fri, 23 May 2008 08:53:01 +1000 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: Message-ID: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> Are you certain cb_calling is even being called? If it's not, that'll be why your variable isn't carrying any value. John's right, cb_calling should definitely declare state as global - and for style, I'd want the global declaration in keys() as well (not strictly necessary, but good form). For debug, I'd drop either an "import pdb ; pdb.set_trace()" (and read up on how to use pdb, it's your friend ;) or a "print args" into the start of cb_calling, see exactly when it's called and what it's doing. But if you're not getting any errors, then it's not a syntactic issue. KevinL On 23/05/2008, at 05:53 , g sobers wrote: > Appreciate the response. > > Are you getting an AttributeError in keys() or is state just None. > > No errors, per se, are generated. So, state=none seems most likely. > > > It looks like cb_calling needs to declare state as global > > def cb_calling(args): > global state > state = args[0] > > As regards to your suggestion, I just implemented it - to no avail. > Same conditions persist. > > Where else should I be looking? > > Best, > wirefree > > > > On 5/22/08, John La Rooy wrote: > Are you getting an AttributeError in keys() or is state just None. > It looks like cb_calling needs to declare state as global > > def cb_calling(args): > global state > state = args[0] > > On Fri, May 23, 2008 at 5:10 AM, g sobers wrote: > G'day! > > Following is a small PyS60 script. The error seems related to basic > syntax - "state" in keys() is not recognized although defined > globally. > > Would appreciate assistance. > > ============================================= > import appuifw, key_codes, e32, telephone > state = None > > def keys(event): > if event['keycode'] == key_codes.EKeyYes: > appuifw.note(u"Doesn't Matter") > elif (event['keycode'] == key_codes.EKeyYes) and (state == > telephone.EStatusConnected): > appuifw.note(u"Yes was pressed and call active") > > def cb_calling(args): > state = args[0] > > def quit(): > app_lock.signal() > > telephone.call_state(cb_calling) > canvas = appuifw.Canvas(event_callback = keys) > appuifw.app.body = canvas > appuifw.app.exit_key_handler = quit > app_lock = e32.Ao_lock() > app_lock.wait() > ============================================== > > Best, > wirefree > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug -------------- next part -------------- An HTML attachment was scrubbed... URL: From tleeuwenburg at gmail.com Fri May 23 01:29:09 2008 From: tleeuwenburg at gmail.com (Tennessee Leeuwenburg) Date: Fri, 23 May 2008 09:29:09 +1000 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: Message-ID: <43c8685c0805221629j5f41fc23q64978fb100972ee8@mail.gmail.com> The "state" in cb_calling is not the same "state" you declare earlier. You'll need to declare it global inside cb_calling for it to work. -T On Fri, May 23, 2008 at 5:10 AM, g sobers wrote: > G'day! > > Following is a small PyS60 script. The error seems related to basic syntax > - "state" in keys() is not recognized although defined globally. > > Would appreciate assistance. > > ============================================= > import appuifw, key_codes, e32, telephone > state = None > > def keys(event): > if event['keycode'] == key_codes.EKeyYes: > appuifw.note(u"Doesn't Matter") > elif (event['keycode'] == key_codes.EKeyYes) and (state == > telephone.EStatusConnected): > appuifw.note(u"Yes was pressed and call active") > > def cb_calling(args): > state = args[0] > > def quit(): > app_lock.signal() > > telephone.call_state(cb_calling) > canvas = appuifw.Canvas(event_callback = keys) > appuifw.app.body = canvas > appuifw.app.exit_key_handler = quit > app_lock = e32.Ao_lock() > app_lock.wait() > ============================================== > > Best, > wirefree > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From abriggs at westnet.com.au Fri May 23 01:39:14 2008 From: abriggs at westnet.com.au (Anthony Briggs) Date: Fri, 23 May 2008 09:39:14 +1000 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> References: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> Message-ID: <20080522233914.GA5601@anthony.house> Hmm, You've got this in your code: canvas = appuifw.Canvas(event_callback = keys) appuifw is a framework, so your keys function will be called in a different 'context'. Your framework might be using state for something else, or is otherwise messing around with globals. Try changing 'state' to 'foo_state' or similar and see if that helps. And yes, you should have 'global state' in each of your functions, otherwise you'll drive a local variable over the top of your global. It's hard to tell what's going on without a traceback, but the following code replicates something which might be similar to your error: state = None def keys(): if state == None: print "Foo!", state else: print "Bar!", state def cb_calling(arg): state = arg def clear_state(): global state del state cb_calling("Wibble") keys() clear_state() keys() === result: anthony at anthony:~$ python test.py Foo! None Traceback (most recent call last): File "test.py", line 21, in keys() File "test.py", line 6, in keys if state == None: NameError: global name 'state' is not defined anthony at anthony:~$ On Fri, May 23, 2008 at 08:53:01AM +1000, Kevin Littlejohn wrote: > Are you certain cb_calling is even being called? If it's not, that'll > be why your variable isn't carrying any value. > > John's right, cb_calling should definitely declare state as global - and > for style, I'd want the global declaration in keys() as well (not > strictly necessary, but good form). > > For debug, I'd drop either an "import pdb ; pdb.set_trace()" (and read > up on how to use pdb, it's your friend ;) or a "print args" into the > start of cb_calling, see exactly when it's called and what it's doing. > But if you're not getting any errors, then it's not a syntactic issue. > > KevinL > > On 23/05/2008, at 05:53 , g sobers wrote: > >> Appreciate the response. >> >> Are you getting an AttributeError in keys() or is state just None. >> >> No errors, per se, are generated. So, state=none seems most likely. >> >> >> It looks like cb_calling needs to declare state as global >> >> def cb_calling(args): >> global state >> state = args[0] >> >> As regards to your suggestion, I just implemented it - to no avail. >> Same conditions persist. >> >> Where else should I be looking? >> >> Best, >> wirefree >> >> >> >> On 5/22/08, John La Rooy wrote: >> Are you getting an AttributeError in keys() or is state just None. >> It looks like cb_calling needs to declare state as global >> >> def cb_calling(args): >> global state >> state = args[0] >> >> On Fri, May 23, 2008 at 5:10 AM, g sobers wrote: >> G'day! >> >> Following is a small PyS60 script. The error seems related to basic >> syntax - "state" in keys() is not recognized although defined >> globally. >> >> Would appreciate assistance. >> >> ============================================= >> import appuifw, key_codes, e32, telephone >> state = None >> >> def keys(event): >> if event['keycode'] == key_codes.EKeyYes: >> appuifw.note(u"Doesn't Matter") >> elif (event['keycode'] == key_codes.EKeyYes) and (state == >> telephone.EStatusConnected): >> appuifw.note(u"Yes was pressed and call active") >> >> def cb_calling(args): >> state = args[0] >> >> def quit(): >> app_lock.signal() >> >> telephone.call_state(cb_calling) >> canvas = appuifw.Canvas(event_callback = keys) >> appuifw.app.body = canvas >> appuifw.app.exit_key_handler = quit >> app_lock = e32.Ao_lock() >> app_lock.wait() >> ============================================== >> >> Best, >> wirefree >> >> _______________________________________________ >> melbourne-pug mailing list >> melbourne-pug at python.org >> http://mail.python.org/mailman/listinfo/melbourne-pug >> >> >> >> _______________________________________________ >> melbourne-pug mailing list >> melbourne-pug at python.org >> http://mail.python.org/mailman/listinfo/melbourne-pug >> >> >> _______________________________________________ >> melbourne-pug mailing list >> melbourne-pug at python.org >> http://mail.python.org/mailman/listinfo/melbourne-pug > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug -- ------------------------------------------------------ HyPerACtIVe?! HEY, Who ArE yoU cAllInG HYPERaCTive?! abriggs at westnet.com.au ------------------------------------------------------ From g.forumz at gmail.com Fri May 23 07:36:44 2008 From: g.forumz at gmail.com (g sobers) Date: Fri, 23 May 2008 01:36:44 -0400 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: <20080522233914.GA5601@anthony.house> References: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> <20080522233914.GA5601@anthony.house> Message-ID: Addressing each of your suggestions below with resulting output: *@Kevin Littlejohn* *- Are you certain cb_calling is even being called? * Confirming the same. Checked via print statement. - *cb_calling should definitely declare state as global - and for style, I'd want the global declaration in keys() as well *Declared: global *state* in keys() as well as global *state* in cb_calling. To no avail. *@Tennessee Leeuwenburg* *- The "state" in cb_calling is not the same "state" you declare earlier. You'll need to declare it global inside cb_calling for it to work.* PyS60 documentation confirms "if a variable is defined outsite any function, it belongs automatically to the global scope." *@*Anthony Briggs *- appuifw is a framework, so your keys function will be called in a different 'context'. Your framework might be using state for something else, or is otherwise messing around with globals. Try changing 'state' to 'foo_state' or similar and see if that helps. *That is indeed correct. However, in the case of the intended functionality, *state* only becomes relevant when a key is pressed i.e. keys() is called. Which state are you suggesting being changed?* ** - And yes, you should have 'global state' in each of your functions, otherwise you'll drive a local variable over the top of your global. *Done. *All of the above attempts have been unsuccessful. Quite perplexing.* Just a brief plain english understanding of the intended functionaity, present results and implemented code: *Canvas receives a key event and passes it to keys(). If the phone's 'yes' key is pressed, a note stating the event displays correctly. However, when the phone rings and is answered, state is assigned 'EStatusConnected' parameter. At this point, second of the if-statements in keys() should result in a note stating 'yes key is pressed & call active'. But, the note statement of the first if-statement continues to be displayed. * *NOTE*: The following code, source for this script, works perfectly. http://mindinthewater.blogspot.com/2008/01/recording-phone-calls-on-s60-phone-part.html Look forward to your suggestion. Best, wirefree -------------- next part -------------- An HTML attachment was scrubbed... URL: From tleeuwenburg at gmail.com Fri May 23 07:45:22 2008 From: tleeuwenburg at gmail.com (Tennessee Leeuwenburg) Date: Fri, 23 May 2008 15:45:22 +1000 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> <20080522233914.GA5601@anthony.house> Message-ID: <43c8685c0805222245y60b89db5lf8b5d51c19a1e496@mail.gmail.com> Hi, Give this a shot in your interpreter state = None def set_state(): print "Scope " + state state = "Hello" set_state() print state I get: UnboundLocalError: local variable 'state' referenced before assignment On Fri, May 23, 2008 at 3:36 PM, g sobers wrote: > Addressing each of your suggestions below with resulting output: > > *@Kevin Littlejohn* > *- Are you certain cb_calling is even being called? * > Confirming the same. Checked via print statement. > > - *cb_calling should definitely declare state as global - and for style, > I'd want the global declaration in keys() as well > *Declared: global *state* in keys() as well as global *state* in cb_calling. > To no avail. > > *@Tennessee Leeuwenburg* > *- The "state" in cb_calling is not the same "state" you declare earlier. > You'll need to declare it global inside cb_calling for it to work.* > PyS60 documentation confirms "if a variable is defined outsite any > function, it belongs automatically to the global scope." > > *@*Anthony Briggs > *- appuifw is a framework, so your keys function will be called in a > different 'context'. Your framework might be using state for something > else, or is otherwise messing around with globals. Try changing > 'state' to 'foo_state' or similar and see if that helps. > *That is indeed correct. However, in the case of the intended > functionality, *state* only becomes relevant when a key is pressed i.e. > keys() is called. > > Which state are you suggesting being changed?* > > ** > - And yes, you should have 'global state' in each of your functions, > otherwise you'll drive a local variable over the top of your global. > *Done. > > > *All of the above attempts have been unsuccessful. Quite perplexing.* > > Just a brief plain english understanding of the intended > functionaity, present results and implemented code: > > *Canvas receives a key event and passes it to keys(). If the phone's 'yes' > key is pressed, a note stating the event displays correctly. However, when > the phone rings and is answered, state is assigned > 'EStatusConnected' parameter. At this point, second of the if-statements in > keys() should result in a note stating 'yes key is pressed & call active'. > But, the note statement of the first if-statement continues to be displayed. > * > > *NOTE*: The following code, source for this script, works perfectly. > > http://mindinthewater.blogspot.com/2008/01/recording-phone-calls-on-s60-phone-part.html > > Look forward to your suggestion. > > Best, > wirefree > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.forumz at gmail.com Fri May 23 07:49:50 2008 From: g.forumz at gmail.com (g sobers) Date: Fri, 23 May 2008 01:49:50 -0400 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> <20080522233914.GA5601@anthony.house> Message-ID: Problem solved. Appreciate the assistance. Best, wirefree On 5/23/08, g sobers wrote: > > Addressing each of your suggestions below with resulting output: > > *@Kevin Littlejohn* > *- Are you certain cb_calling is even being called? * > Confirming the same. Checked via print statement. > > - *cb_calling should definitely declare state as global - and for style, > I'd want the global declaration in keys() as well > *Declared: global *state* in keys() as well as global *state* in cb_calling. > To no avail. > > *@Tennessee Leeuwenburg* > *- The "state" in cb_calling is not the same "state" you declare earlier. > You'll need to declare it global inside cb_calling for it to work.* > PyS60 documentation confirms "if a variable is defined outsite any > function, it belongs automatically to the global scope." > > *@*Anthony Briggs > *- appuifw is a framework, so your keys function will be called in a > different 'context'. Your framework might be using state for something > else, or is otherwise messing around with globals. Try changing > 'state' to 'foo_state' or similar and see if that helps. > *That is indeed correct. However, in the case of the intended > functionality, *state* only becomes relevant when a key is pressed i.e. > keys() is called. > > Which state are you suggesting being changed?* > > ** > - And yes, you should have 'global state' in each of your functions, > otherwise you'll drive a local variable over the top of your global. > *Done. > > > *All of the above attempts have been unsuccessful. Quite perplexing.* > > Just a brief plain english understanding of the intended > functionaity, present results and implemented code: > > *Canvas receives a key event and passes it to keys(). If the phone's 'yes' > key is pressed, a note stating the event displays correctly. However, when > the phone rings and is answered, state is assigned > 'EStatusConnected' parameter. At this point, second of the if-statements in > keys() should result in a note stating 'yes key is pressed & call active'. > But, the note statement of the first if-statement continues to be displayed. > * > > *NOTE*: The following code, source for this script, works perfectly. > > http://mindinthewater.blogspot.com/2008/01/recording-phone-calls-on-s60-phone-part.html > > Look forward to your suggestion. > > Best, > wirefree > -------------- next part -------------- An HTML attachment was scrubbed... URL: From abriggs at westnet.com.au Fri May 23 11:56:25 2008 From: abriggs at westnet.com.au (Anthony Briggs) Date: Fri, 23 May 2008 19:56:25 +1000 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: References: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> <20080522233914.GA5601@anthony.house> Message-ID: <20080523095625.GA6958@anthony.house> So what was the issue in the end? It helps to know the answer if people have a similar problem and find the list archives via google. (Also, I'm curious). Thanks, Anthony On Fri, May 23, 2008 at 01:49:50AM -0400, g sobers wrote: > Problem solved. > > Appreciate the assistance. > > Best, > wirefree > > > > On 5/23/08, g sobers wrote: > > > > Addressing each of your suggestions below with resulting output: > > > > *@Kevin Littlejohn* > > *- Are you certain cb_calling is even being called? * > > Confirming the same. Checked via print statement. > > > > - *cb_calling should definitely declare state as global - and for style, > > I'd want the global declaration in keys() as well > > *Declared: global *state* in keys() as well as global *state* in cb_calling. > > To no avail. > > > > *@Tennessee Leeuwenburg* > > *- The "state" in cb_calling is not the same "state" you declare earlier. > > You'll need to declare it global inside cb_calling for it to work.* > > PyS60 documentation confirms "if a variable is defined outsite any > > function, it belongs automatically to the global scope." > > > > *@*Anthony Briggs > > *- appuifw is a framework, so your keys function will be called in a > > different 'context'. Your framework might be using state for something > > else, or is otherwise messing around with globals. Try changing > > 'state' to 'foo_state' or similar and see if that helps. > > *That is indeed correct. However, in the case of the intended > > functionality, *state* only becomes relevant when a key is pressed i.e. > > keys() is called. > > > > Which state are you suggesting being changed?* > > > > ** > > - And yes, you should have 'global state' in each of your functions, > > otherwise you'll drive a local variable over the top of your global. > > *Done. > > > > > > *All of the above attempts have been unsuccessful. Quite perplexing.* > > > > Just a brief plain english understanding of the intended > > functionaity, present results and implemented code: > > > > *Canvas receives a key event and passes it to keys(). If the phone's 'yes' > > key is pressed, a note stating the event displays correctly. However, when > > the phone rings and is answered, state is assigned > > 'EStatusConnected' parameter. At this point, second of the if-statements in > > keys() should result in a note stating 'yes key is pressed & call active'. > > But, the note statement of the first if-statement continues to be displayed. > > * > > > > *NOTE*: The following code, source for this script, works perfectly. > > > > http://mindinthewater.blogspot.com/2008/01/recording-phone-calls-on-s60-phone-part.html > > > > Look forward to your suggestion. > > > > Best, > > wirefree > > > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug -- ------------------------------------------------------ HyPerACtIVe?! HEY, Who ArE yoU cAllInG HYPERaCTive?! abriggs at westnet.com.au ------------------------------------------------------ From g.forumz at gmail.com Sat May 24 07:46:02 2008 From: g.forumz at gmail.com (g sobers) Date: Sat, 24 May 2008 01:46:02 -0400 Subject: [melbourne-pug] Simple syntactic error? In-Reply-To: <20080523095625.GA6958@anthony.house> References: <015B7CE2-A44A-4589-B7AE-9A10C7EDDB27@obsidian.com.au> <20080522233914.GA5601@anthony.house> <20080523095625.GA6958@anthony.house> Message-ID: Appreciate all your advise & suggestions. The issue was one of appropriate declaration of 'state' variable. Perhaps someone can identify the gap vis-a-vis the following description in text. See: http://img264.imageshack.us/img264/3207/image365xa7.jpg Best, wirefree On 5/23/08, Anthony Briggs wrote: > > So what was the issue in the end? It helps to know the answer if people > have a similar problem and find the list archives via google. (Also, I'm > curious). > > Thanks, > > > Anthony > > > > On Fri, May 23, 2008 at 01:49:50AM -0400, g sobers wrote: > > Problem solved. > > > > Appreciate the assistance. > > > > Best, > > wirefree > > > > > > > > On 5/23/08, g sobers wrote: > > > > > > Addressing each of your suggestions below with resulting output: > > > > > > *@Kevin Littlejohn* > > > *- Are you certain cb_calling is even being called? * > > > Confirming the same. Checked via print statement. > > > > > > - *cb_calling should definitely declare state as global - and for > style, > > > I'd want the global declaration in keys() as well > > > *Declared: global *state* in keys() as well as global *state* in > cb_calling. > > > To no avail. > > > > > > *@Tennessee Leeuwenburg* > > > *- The "state" in cb_calling is not the same "state" you declare > earlier. > > > You'll need to declare it global inside cb_calling for it to work.* > > > PyS60 documentation confirms "if a variable is defined outsite any > > > function, it belongs automatically to the global scope." > > > > > > *@*Anthony Briggs > > > *- appuifw is a framework, so your keys function will be called in a > > > different 'context'. Your framework might be using state for something > > > else, or is otherwise messing around with globals. Try changing > > > 'state' to 'foo_state' or similar and see if that helps. > > > *That is indeed correct. However, in the case of the intended > > > functionality, *state* only becomes relevant when a key is pressed i.e. > > > keys() is called. > > > > > > Which state are you suggesting being changed?* > > > > > > ** > > > - And yes, you should have 'global state' in each of your functions, > > > otherwise you'll drive a local variable over the top of your global. > > > *Done. > > > > > > > > > *All of the above attempts have been unsuccessful. Quite perplexing.* > > > > > > Just a brief plain english understanding of the intended > > > functionaity, present results and implemented code: > > > > > > *Canvas receives a key event and passes it to keys(). If the phone's > 'yes' > > > key is pressed, a note stating the event displays correctly. However, > when > > > the phone rings and is answered, state is assigned > > > 'EStatusConnected' parameter. At this point, second of the > if-statements in > > > keys() should result in a note stating 'yes key is pressed & call > active'. > > > But, the note statement of the first if-statement continues to be > displayed. > > > * > > > > > > *NOTE*: The following code, source for this script, works perfectly. > > > > > > > http://mindinthewater.blogspot.com/2008/01/recording-phone-calls-on-s60-phone-part.html > > > > > > Look forward to your suggestion. > > > > > > Best, > > > wirefree > > > > > > > _______________________________________________ > > melbourne-pug mailing list > > melbourne-pug at python.org > > http://mail.python.org/mailman/listinfo/melbourne-pug > > > -- > ------------------------------------------------------ > HyPerACtIVe?! HEY, Who ArE yoU cAllInG HYPERaCTive?! > abriggs at westnet.com.au > ------------------------------------------------------ > _______________________________________________ > melbourne-pug mailing list > melbourne-pug at python.org > http://mail.python.org/mailman/listinfo/melbourne-pug > -------------- next part -------------- An HTML attachment was scrubbed... URL: