title: How to know what function throws the exception in Python
body: <p>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.</p>
  <pre><code>Exception TypeError: TypeError(&quot;argument of type 'NoneType' is not iterable&quot;,) in &lt;bound method Popen3.__del__ of &lt;popen2.Popen3 instance at 0x7fccba7b65f0&gt;&gt; ignored
  Exception TypeError: TypeError(&quot;argument of type 'NoneType' is not iterable&quot;,) in &lt;bound method Popen3.__del__ of &lt;popen2.Popen3 instance at 0x7fccba7b62d8&gt;&gt; ignored
  Exception TypeError: TypeError(&quot;argument of type 'NoneType' is not iterable&quot;,) in &lt;bound method Popen3.__del__ of &lt;popen2.Popen3 instance at 0x7fccba824ef0&gt;&gt; ignored
  Exception TypeError: TypeError(&quot;argument of type 'NoneType' is not iterable&quot;,) in &lt;bound method Popen3.__del__ of &lt;popen2.Popen3 instance at 0x7fccba824f80&gt;&gt; ignored
  </code></pre>
  <p>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.</p>