On Nov 7, 10:30 am, Peter Otten <[EMAIL PROTECTED]> wrote: > Paul McGuire wrote: > > Is there any way to hide portions of an exception stack trace? When > > Add a try...except at the appropriate level. Why do you want to do anything > more complex? > > Peter
I thought I tried that, and now in retrying, I learned a little about exceptions. My first attempt was to use this code in the entry method of the API (parseString): try: loc, tokens = self._parse( instring, 0 ) if parseAll: loc = self.preParse( instring, loc ) StringEnd()._parse( instring, loc ) except ParseBaseException, exc: raise else: return tokens This didn't change the stack trace at all. But when I change it to this: try: loc, tokens = self._parse( instring, 0 ) if parseAll: loc = self.preParse( instring, loc ) StringEnd()._parse( instring, loc ) except ParseBaseException, exc: raise exc else: return tokens Now the stack trace only shows my top-level API method. (I've also added a little self-explanatory comment as to why I am catching an exception, just to raise it again.) Thanks for the nudge in the right direction, -- Paul -- http://mail.python.org/mailman/listinfo/python-list