generator exceptions

Alexandru Mosoi brtzsnr at gmail.com
Fri Sep 19 09:40:00 EDT 2008


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?



More information about the Python-list mailing list