Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 11:06, 15 April 2008.

Exception Harness

From Forum Nokia Wiki

This method is used for debugging standalone applications in PyS60

try:
    # Actual program is here.
    1 / 0
except:
    import sys
    import traceback
    import e32
    import appuifw
    appuifw.app.screen="normal"               # Restore screen to normal size.
    appuifw.app.focus=None                    # Disable focus callback.
    body=appuifw.Text()
    appuifw.app.body=body                     # Create and use a text control.
    applock=e32.Ao_lock()
    def quit():applock.signal()
    appuifw.app.exit_key_handler=quit         # Override softkey handler.
    appuifw.app.menu=[(u"Exit", quit)]        # Override application menu.
    body.set(unicode("\n".join(traceback.format_exception(*sys.exc_info()))))
    applock.wait()                            # Wait for exit key to be pressed.
    appuifw.app.set_exit()

More methods for Debugging standalone applications in python can be found at Python Debugging techniques

 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZpythonQ
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX