0

I have a python script over 2000 lines and it's through the below exception on the production server and I'm not able to reproduce the issue locally to debug it and I don't know where it comes from.

Exception TypeError: TypeError("argument of type 'NoneType' is not iterable",) in <bound method Popen3.__del__ of <popen2.Popen3 instance at 0x7fccba7b65f0>> ignored
Exception TypeError: TypeError("argument of type 'NoneType' is not iterable",) in <bound method Popen3.__del__ of <popen2.Popen3 instance at 0x7fccba7b62d8>> ignored
Exception TypeError: TypeError("argument of type 'NoneType' is not iterable",) in <bound method Popen3.__del__ of <popen2.Popen3 instance at 0x7fccba824ef0>> ignored
Exception TypeError: TypeError("argument of type 'NoneType' is not iterable",) in <bound method Popen3.__del__ of <popen2.Popen3 instance at 0x7fccba824f80>> ignored

Is there a way to make the interpreter print the trace for the exception as Java does? To be able to know what is throwing this exception.

runDOSrun
  • 10,359
  • 7
  • 47
  • 57
  • ```from sys import exc_info``` https://stackoverflow.com/questions/8238360/how-to-save-traceback-sys-exc-info-values-in-a-variable – Jen H Feb 19 '21 at 14:09

1 Answers1

0

The simplest way is to use traceback.print_exc() in the except block:

try:
    1[0]  # raises
except TypeError:
    traceback.print_exc()
    raise
bereal
  • 32,519
  • 6
  • 58
  • 104