[python-win32] Exception handling wrapper/function for somethinglike a whole class

Jacob Kruger jacob at blindza.co.za
Tue Dec 17 10:04:44 CET 2013


Ok, one thing now came across is the cgitb module, and, the following bit of code somewhere near top might help it at least log errors a bit better:

import cgitb, os
cgitb.enable(format="text", logdir=os.environ["APPDATA"] + \\appAuthor\\appName)

That should then, hopefully, at least generate a form of error/exception log in the location I specify as logdir.

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

  ----- Original Message ----- 
  From: Jacob Kruger 
  To: python-win32 at python.org 
  Sent: Tuesday, December 17, 2013 05:44 AM
  Subject: [python-win32] Exception handling wrapper/function for somethinglike a whole class


  Like subject line says, and while would generally prefer to implement specific pieces of error handling try...except code blocks, etc., per code/functionality section, am currently trying to figure out why a test user is experiencing issues with some code making use of things like user app data file locations, etc., and am not exactly sure how/why/when errors/exceptions are occuring, and since this is happening on something like a windows7 machine with UAC turned on, etc., and since these are currently executing/operating as sort of py2exe 'compiled' applets, it's unable to generate the sort of automatic error log files at the moment either - not sure if relevant, but, used os.chdir to try changing the sort of active/current directory to the app specific user data location early on during instantiation of the classes, etc., but, doesn't seem to affect automated error logging target location as such, and, I think the app trying to then generate those automated error log files is then also raising file system access issues itself.

  Anyway, while can implement try...except blocks in all of the pieces of code, event handlers, function calls etc., I would like to, for now implement something like where in PHP you can just assign your own function to be the sort of default exception/error handler at some stages, and just wondering how you could possibly do something like that for a class object/element, etc.,such that it could then handle either all, or multiple exception types, etc.?

  And, if am confused, or targeting the wrong approach, you are also welcome to offer better suggestions/guidelines relating to any form of exception handling approach, etc.?

  TIA

  Jacob Kruger
  Blind Biker
  Skype: BlindZA
  '...fate had broken his body, but not his spirit...'



------------------------------------------------------------------------------


  _______________________________________________
  python-win32 mailing list
  python-win32 at python.org
  https://mail.python.org/mailman/listinfo/python-win32
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20131217/3b6bf01c/attachment.html>


More information about the python-win32 mailing list