[python-win32] vb errors from Python COM object now include the traceback lines
Lloyd Kvam
python at venix.com
Fri Apr 20 00:30:54 CEST 2012
On Thu, 2012-04-19 at 16:32 -0400, Lloyd Kvam wrote:
> I am hoping one of you can point me in the right direction. My
> alternative appears to be (painfully) writing some VB code to discard
> the traceback lines from Err.Description.
I read more carefully through Python Programming on Win32 and came up
with this code:
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
class DefaultDebugDispatcher(
win32com.server.dispatcher.DefaultDebugDispatcher):
def _HandleException_(self):
excls,exself = sys.exc_info()[:2]
if not IsCOMServerException(excls):
raise COMException(description = str(exself),
scode = winerror.E_INVALIDARG,
)
raise
useDispatcher = DefaultDebugDispatcher
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
I tried several other winerror codes, but they all wiped out my
description. This seems to work for my purposes. There is some
additional code that emails traces to me, but I snipped it since it
makes little sense without a lot more context.
Please let me know if I missed a better approach.
Thanks very much for your attention.
--
Lloyd Kvam
Venix Corp
DLSLUG/GNHLUG library
http://dlslug.org/library.html
http://www.librarything.com/catalog/dlslug
http://www.librarything.com/catalog/dlslug&sort=stamp
http://www.librarything.com/rss/recent/dlslug
More information about the python-win32
mailing list