WindowXML OnClick() error handling

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
juju0 Offline
XBMC Skin Manager author
Posts: 44
Joined: Nov 2006
Reputation: 0
Post: #1
Hello,
i'm a noob in XBMC python coding and I have a problem with WindowXML OnClick method : I use the following function for catch exceptions :
Code:
def Excepthook(type, value, tb):
    """
        Intercept all exceptions out of try..except statements and
        make the log.txt file with traceback
    """
    log = open(HOME_DIR+"log.txt","w+")
    log.write("Exception report\n\n")
    lines=traceback.format_exception(type, value, tb)
    log.write("---------------------Traceback lines-----------------------\n")
    log.write("".join(lines))
    log.write("-----------------------------------------------------------\n\n")
    log.write("If you think this is a bug, please send me this file. Thank you.")
    log.close()
    msgbox("An exception occured. Look at the log.txt file.", title="Problem!") # it's a shortcut for Ok dialogs
sys.excepthook=Excepthook

But it's don't work at all in OnClick methods Sad
find quote