i have a generator that raises an exception when calling next(), however if I try to catch the exception and print the traceback i get only the line where next() was called while True: try: iterator.next() except StopIteration: break except Exception, e: traceback.print_exc() how do I get the traceback starting from where exception was raised in first place?