<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<a class="moz-txt-link-abbreviated" href="mailto:yinon.me@gmail.com">yinon.me@gmail.com</a> wrote:
<blockquote   cite="mid8ab4f9a8-3629-4f6a-bbf2-1deed8624215@w24g2000prd.googlegroups.com"   type="cite">
  <pre wrap="">On Dec 14, 8:07 pm, Brian Allen Vanderburg II
<a class="moz-txt-link-rfc2396E" href="mailto:BrianVanderbu...@aim.com"><BrianVanderbu...@aim.com></a> wrote:
  </pre>
  <pre wrap=""><!---->
Hi,

The interface of extract_tb is:
traceback.extract_tb(tb, limit=None)
try to play with the 'limit' argument

Good luck,
   Yinon
--
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a>
  </pre>
</blockquote>
I have, but the limit argument shows the first items and not the last
items (where the exception occurred):<br>
<br>
def a():<br>
    b()<br>
<br>
def b():<br>
    c()<br>
<br>
def c():<br>
    d()<br>
<br>
def d():<br>
    open('/path/to/fake/file')<br>
<br>
try:<br>
    a():<br>
except:<br>
    print traceback.format_exc(limit=2)<br>
<br>
try:<br>
    a():<br>
except:<br>
    print format_partial_exc(limit=2)<br>
<br>
<br>
<br>
Prints something like this<br>
<br>
<br>
Traceback (most recent call last):<br>
  File "b.py", line 52, in ?<br>
    a()<br>
  File "b.py", line 19, in a<br>
    b()<br>
IOError: [Errno 2] No such file or directory: '/path/to/fake/file'<br>
<br>
Traceback (most recent call last):<br>
  File "b.py", line 25, in c<br>
    d()<br>
  File "b.py", line 29, in d<br>
    handle=open('/path/to/fake/file', 'rt')<br>
IOError: [Errno 2] No such file or directory: '/path/to/fake/file'<br>
<br>
<br>
The second one (using format_partial_exc) prints the last two items of
the traceback instead of the first, showing the error is line 29 in
function d, the first one limits the traceback but gives no indication
of where the error occurred.<br>
<br>
<br>
Brian A. Vanderburg II<br>
</body>
</html>