"Allen Fowler" <[EMAIL PROTECTED]> wrote > Now, I would like to do this: > > for item in bigset: > try: > self.__sub1(item) > self.__sub2(item) > self.__sub3(item) > except StandardError: > # Log error and continue to next item in set. > log_error_to_file() > > In the error log, I would like to record a stacktrace and various > local variables that existed in subX at the time the Exception > was thrown...
Look at the traceback module. It was discussed in a recent thread - A Simple question - starting on October 2nd... > (even though the actual exception may have been thrown from > deep inside some 3rd party module that subX called) Examining data at the time of an exception is easy enough but only if the data is in scope. If it is local data within the raising function then bit will be gone by the time you catch the exception. The only way would be to pass it as part of the exception at the point of raise. But if its global or variables at the catching level then you can just use them as normal from inside the except clause. HTH, Alan G _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor