Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > core-updates > by-pkgid > b9a6a1b9f2781444d2917afd8e4421ab > files > 668

ipython-doc-2.3.0-2.2.mga5.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Module: core.ultratb &mdash; IPython 2.3.0 documentation</title>
    
    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../',
        VERSION:     '2.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../_static/doctools.js"></script>
    <link rel="top" title="IPython 2.3.0 documentation" href="../../index.html" />
    <link rel="up" title="The IPython API" href="../index.html" />
    <link rel="next" title="Module: core.usage" href="IPython.core.usage.html" />
    <link rel="prev" title="Module: core.splitinput" href="IPython.core.splitinput.html" /> 
  </head>
  <body>

<div style="background-color: white; text-align: left; padding: 10px 10px 15px 15px">
<a href="http://ipython.org/"><img src="../../_static/logo.png" border="0" alt="IPython Documentation"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="IPython.core.usage.html" title="Module: core.usage"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="IPython.core.splitinput.html" title="Module: core.splitinput"
             accesskey="P">previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../../index.html">documentation </a> &raquo;</li>

          <li><a href="../index.html" accesskey="U">The IPython API</a> &raquo;</li> 
      </ul>
    </div>

      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Module: <tt class="docutils literal"><span class="pre">core.ultratb</span></tt></a><ul>
<li><a class="reference internal" href="#color-schemes">Color schemes</a></li>
<li><a class="reference internal" href="#classes">7 Classes</a></li>
<li><a class="reference internal" href="#functions">4 Functions</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="IPython.core.splitinput.html"
                        title="previous chapter">Module: <tt class="docutils literal"><span class="pre">core.splitinput</span></tt></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="IPython.core.usage.html"
                        title="next chapter">Module: <tt class="docutils literal"><span class="pre">core.usage</span></tt></a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../_sources/api/generated/IPython.core.ultratb.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-IPython.core.ultratb">
<span id="module-core-ultratb"></span><h1>Module: <tt class="xref py py-mod docutils literal"><span class="pre">core.ultratb</span></tt><a class="headerlink" href="#module-IPython.core.ultratb" title="Permalink to this headline">¶</a></h1>
<p>Verbose and colourful traceback formatting.</p>
<p><strong>ColorTB</strong></p>
<p>I&#8217;ve always found it a bit hard to visually parse tracebacks in Python.  The
ColorTB class is a solution to that problem.  It colors the different parts of a
traceback in a manner similar to what you would expect from a syntax-highlighting
text editor.</p>
<p>Installation instructions for ColorTB:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span><span class="nn">ultratb</span>
<span class="n">sys</span><span class="o">.</span><span class="n">excepthook</span> <span class="o">=</span> <span class="n">ultratb</span><span class="o">.</span><span class="n">ColorTB</span><span class="p">()</span>
</pre></div>
</div>
<p><strong>VerboseTB</strong></p>
<p>I&#8217;ve also included a port of Ka-Ping Yee&#8217;s &#8220;cgitb.py&#8221; that produces all kinds
of useful info when a traceback occurs.  Ping originally had it spit out HTML
and intended it for CGI programmers, but why should they have all the fun?  I
altered it to spit out colored text to the terminal.  It&#8217;s a bit overwhelming,
but kind of neat, and maybe useful for long-running programs that you believe
are bug-free.  If a crash <em>does</em> occur in that type of program you want details.
Give it a shot&#8211;you&#8217;ll love it or you&#8217;ll hate it.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The Verbose mode prints the variables currently visible where the exception
happened (shortening their strings if too long). This can potentially be
very slow, if you happen to have a huge data structure whose string
representation is complex to compute. Your computer may appear to freeze for
a while with cpu usage at 100%. If this occurs, you can cancel the traceback
with Ctrl-C (maybe hitting it more than once).</p>
<p class="last">If you encounter this kind of situation often, you may want to use the
Verbose_novars mode instead of the regular Verbose, which avoids formatting
variables (but otherwise includes the information and context given by
Verbose).</p>
</div>
<p>Installation instructions for ColorTB:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span><span class="nn">ultratb</span>
<span class="n">sys</span><span class="o">.</span><span class="n">excepthook</span> <span class="o">=</span> <span class="n">ultratb</span><span class="o">.</span><span class="n">VerboseTB</span><span class="p">()</span>
</pre></div>
</div>
<p>Note:  Much of the code in this module was lifted verbatim from the standard
library module &#8216;traceback.py&#8217; and Ka-Ping Yee&#8217;s &#8216;cgitb.py&#8217;.</p>
<div class="section" id="color-schemes">
<h2>Color schemes<a class="headerlink" href="#color-schemes" title="Permalink to this headline">¶</a></h2>
<p>The colors are defined in the class TBTools through the use of the
ColorSchemeTable class. Currently the following exist:</p>
<blockquote>
<div><ul class="simple">
<li>NoColor: allows all of this module to be used in any terminal (the color
escapes are just dummy blank strings).</li>
<li>Linux: is meant to look good in a terminal like the Linux console (black
or very dark background).</li>
<li>LightBG: similar to Linux but swaps dark/light colors to be more readable
in light background terminals.</li>
</ul>
</div></blockquote>
<p>You can implement other color schemes easily, the syntax is fairly
self-explanatory. Please send back new schemes you develop to the author for
possible inclusion in future releases.</p>
<p>Inheritance diagram:</p>
<p class="graphviz">
digraph inheritance03e43aa880 {
rankdir=LR;
size=&quot;8.0, 12.0&quot;;
  &quot;core.ultratb.AutoFormattedTB&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.AutoFormattedTB&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;A traceback printer which can be called on the fly.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.FormattedTB&quot; -&gt; &quot;core.ultratb.AutoFormattedTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;core.ultratb.ColorTB&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.ColorTB&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Shorthand to initialize a FormattedTB in Linux colors mode.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.FormattedTB&quot; -&gt; &quot;core.ultratb.ColorTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;core.ultratb.FormattedTB&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.FormattedTB&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Subclass ListTB but allow calling with a traceback.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.VerboseTB&quot; -&gt; &quot;core.ultratb.FormattedTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;core.ultratb.ListTB&quot; -&gt; &quot;core.ultratb.FormattedTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;core.ultratb.ListTB&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.ListTB&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Print traceback information from a traceback list, with optional color.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.TBTools&quot; -&gt; &quot;core.ultratb.ListTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;core.ultratb.SyntaxTB&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.SyntaxTB&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Extension which holds some state: the last exception value&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.ListTB&quot; -&gt; &quot;core.ultratb.SyntaxTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
  &quot;core.ultratb.TBTools&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.TBTools&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;Basic tools used by all traceback printer classes.&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.VerboseTB&quot; [style=&quot;setlinewidth(0.5)&quot;,URL=&quot;#IPython.core.ultratb.VerboseTB&quot;,fontname=&quot;Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans&quot;,tooltip=&quot;A port of Ka-Ping Yee's cgitb.py module that outputs color text instead&quot;,height=0.25,shape=box,fontsize=10];
  &quot;core.ultratb.TBTools&quot; -&gt; &quot;core.ultratb.VerboseTB&quot; [arrowsize=0.5,style=&quot;setlinewidth(0.5)&quot;];
}
</p>
</div>
<div class="section" id="classes">
<h2>7 Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="IPython.core.ultratb.TBTools">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">TBTools</tt><big>(</big><em>color_scheme=u'NoColor'</em>, <em>call_pdb=False</em>, <em>ostream=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="http://docs.python.org/2/library/functions.html#object" title="(in Python v2.7)"><tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></a></p>
<p>Basic tools used by all traceback printer classes.</p>
<dl class="method">
<dt id="IPython.core.ultratb.TBTools.__init__">
<tt class="descname">__init__</tt><big>(</big><em>color_scheme=u'NoColor'</em>, <em>call_pdb=False</em>, <em>ostream=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.TBTools.color_toggle">
<tt class="descname">color_toggle</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools.color_toggle" title="Permalink to this definition">¶</a></dt>
<dd><p>Toggle between the currently active color scheme and NoColor.</p>
</dd></dl>

<dl class="attribute">
<dt id="IPython.core.ultratb.TBTools.ostream">
<tt class="descname">ostream</tt><a class="headerlink" href="#IPython.core.ultratb.TBTools.ostream" title="Permalink to this definition">¶</a></dt>
<dd><p>Output stream that exceptions are written to.</p>
<p>Valid values are:</p>
<ul class="simple">
<li>None: the default, which means that IPython will dynamically resolve
to io.stdout.  This ensures compatibility with most tools, including
Windows (where plain stdout doesn&#8217;t recognize ANSI escapes).</li>
<li>Any object with &#8216;write&#8217; and &#8216;flush&#8217; attributes.</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.TBTools.set_colors">
<tt class="descname">set_colors</tt><big>(</big><em>*args</em>, <em>**kw</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools.set_colors" title="Permalink to this definition">¶</a></dt>
<dd><p>Shorthand access to the color table scheme selector method.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.TBTools.stb2text">
<tt class="descname">stb2text</tt><big>(</big><em>stb</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools.stb2text" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a structured traceback (a list) to a string.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.TBTools.structured_traceback">
<tt class="descname">structured_traceback</tt><big>(</big><em>etype</em>, <em>evalue</em>, <em>tb</em>, <em>tb_offset=None</em>, <em>context=5</em>, <em>mode=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools.structured_traceback" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of traceback frames.</p>
<p>Must be implemented by each class.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.TBTools.text">
<tt class="descname">text</tt><big>(</big><em>etype</em>, <em>value</em>, <em>tb</em>, <em>tb_offset=None</em>, <em>context=5</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.TBTools.text" title="Permalink to this definition">¶</a></dt>
<dd><p>Return formatted traceback.</p>
<p>Subclasses may override this if they add extra arguments.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.core.ultratb.ListTB">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">ListTB</tt><big>(</big><em>color_scheme=u'NoColor'</em>, <em>call_pdb=False</em>, <em>ostream=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ListTB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.core.ultratb.TBTools" title="IPython.core.ultratb.TBTools"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.TBTools</span></tt></a></p>
<p>Print traceback information from a traceback list, with optional color.</p>
<p>Calling requires 3 arguments: (etype, evalue, elist)
as would be obtained by:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">etype</span><span class="p">,</span> <span class="n">evalue</span><span class="p">,</span> <span class="n">tb</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">exc_info</span><span class="p">()</span>
<span class="k">if</span> <span class="n">tb</span><span class="p">:</span>
  <span class="n">elist</span> <span class="o">=</span> <span class="n">traceback</span><span class="o">.</span><span class="n">extract_tb</span><span class="p">(</span><span class="n">tb</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
  <span class="n">elist</span> <span class="o">=</span> <span class="bp">None</span>
</pre></div>
</div>
<p>It can thus be used by programs which need to process the traceback before
printing (such as console replacements based on the code module from the
standard library).</p>
<p>Because they are meant to be called without a full traceback (only a
list), instances of this class can&#8217;t call the interactive pdb debugger.</p>
<dl class="method">
<dt id="IPython.core.ultratb.ListTB.__init__">
<tt class="descname">__init__</tt><big>(</big><em>color_scheme=u'NoColor'</em>, <em>call_pdb=False</em>, <em>ostream=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ListTB.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.ListTB.get_exception_only">
<tt class="descname">get_exception_only</tt><big>(</big><em>etype</em>, <em>value</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ListTB.get_exception_only" title="Permalink to this definition">¶</a></dt>
<dd><p>Only print the exception type and message, without a traceback.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>etype</strong> : exception type</p>
<p class="last"><strong>value</strong> : exception value</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.ListTB.show_exception_only">
<tt class="descname">show_exception_only</tt><big>(</big><em>etype</em>, <em>evalue</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ListTB.show_exception_only" title="Permalink to this definition">¶</a></dt>
<dd><p>Only print the exception type and message, without a traceback.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>etype</strong> : exception type</p>
<p class="last"><strong>value</strong> : exception value</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.ListTB.structured_traceback">
<tt class="descname">structured_traceback</tt><big>(</big><em>etype</em>, <em>value</em>, <em>elist</em>, <em>tb_offset=None</em>, <em>context=5</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ListTB.structured_traceback" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a color formatted string with the traceback info.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>etype</strong> : exception type</p>
<blockquote>
<div><p>Type of the exception raised.</p>
</div></blockquote>
<p><strong>value</strong> : object</p>
<blockquote>
<div><p>Data stored in the exception</p>
</div></blockquote>
<p><strong>elist</strong> : list</p>
<blockquote>
<div><p>List of frames, see class docstring for details.</p>
</div></blockquote>
<p><strong>tb_offset</strong> : int, optional</p>
<blockquote>
<div><p>Number of frames in the traceback to skip.  If not given, the
instance value is used (set in constructor).</p>
</div></blockquote>
<p><strong>context</strong> : int, optional</p>
<blockquote>
<div><p>Number of lines of context information to print.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">String with formatted exception.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.core.ultratb.VerboseTB">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">VerboseTB</tt><big>(</big><em>color_scheme=u'Linux'</em>, <em>call_pdb=False</em>, <em>ostream=None</em>, <em>tb_offset=0</em>, <em>long_header=False</em>, <em>include_vars=True</em>, <em>check_cache=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.VerboseTB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.core.ultratb.TBTools" title="IPython.core.ultratb.TBTools"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.TBTools</span></tt></a></p>
<p>A port of Ka-Ping Yee&#8217;s cgitb.py module that outputs color text instead
of HTML.  Requires inspect and pydoc.  Crazy, man.</p>
<p>Modified version which optionally strips the topmost entries from the
traceback, to be used with alternate interpreters (because their own code
would appear in the traceback).</p>
<dl class="method">
<dt id="IPython.core.ultratb.VerboseTB.__init__">
<tt class="descname">__init__</tt><big>(</big><em>color_scheme=u'Linux'</em>, <em>call_pdb=False</em>, <em>ostream=None</em>, <em>tb_offset=0</em>, <em>long_header=False</em>, <em>include_vars=True</em>, <em>check_cache=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.VerboseTB.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Specify traceback offset, headers and color scheme.</p>
<p>Define how many frames to drop from the tracebacks. Calling it with
tb_offset=1 allows use of this handler in interpreters which will have
their own code at the top of the traceback (VerboseTB will first
remove that frame before printing the traceback info).</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.VerboseTB.debugger">
<tt class="descname">debugger</tt><big>(</big><em>force=False</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.VerboseTB.debugger" title="Permalink to this definition">¶</a></dt>
<dd><p>Call up the pdb debugger if desired, always clean up the tb
reference.</p>
<p>Keywords:</p>
<blockquote>
<div><ul class="simple">
<li>force(False): by default, this routine checks the instance call_pdb
flag and does not actually invoke the debugger if the flag is false.
The &#8216;force&#8217; option forces the debugger to activate even if the flag
is false.</li>
</ul>
</div></blockquote>
<p>If the call_pdb flag is set, the pdb interactive debugger is
invoked. In all cases, the self.tb reference to the current traceback
is deleted to prevent lingering references which hamper memory
management.</p>
<p>Note that each call to pdb() does an &#8216;import readline&#8217;, so if your app
requires a special setup for the readline completers, you&#8217;ll have to
fix that by hand after invoking the exception handler.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.VerboseTB.structured_traceback">
<tt class="descname">structured_traceback</tt><big>(</big><em>etype</em>, <em>evalue</em>, <em>etb</em>, <em>tb_offset=None</em>, <em>context=5</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.VerboseTB.structured_traceback" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a nice text document describing the traceback.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.core.ultratb.FormattedTB">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">FormattedTB</tt><big>(</big><em>mode=u'Plain'</em>, <em>color_scheme=u'Linux'</em>, <em>call_pdb=False</em>, <em>ostream=None</em>, <em>tb_offset=0</em>, <em>long_header=False</em>, <em>include_vars=False</em>, <em>check_cache=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.FormattedTB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.core.ultratb.VerboseTB" title="IPython.core.ultratb.VerboseTB"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.VerboseTB</span></tt></a>, <a class="reference internal" href="#IPython.core.ultratb.ListTB" title="IPython.core.ultratb.ListTB"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.ListTB</span></tt></a></p>
<p>Subclass ListTB but allow calling with a traceback.</p>
<p>It can thus be used as a sys.excepthook for Python &gt; 2.1.</p>
<p>Also adds &#8216;Context&#8217; and &#8216;Verbose&#8217; modes, not available in ListTB.</p>
<p>Allows a tb_offset to be specified. This is useful for situations where
one needs to remove a number of topmost frames from the traceback (such as
occurs with python programs that themselves execute other python code,
like Python shells).</p>
<dl class="method">
<dt id="IPython.core.ultratb.FormattedTB.__init__">
<tt class="descname">__init__</tt><big>(</big><em>mode=u'Plain'</em>, <em>color_scheme=u'Linux'</em>, <em>call_pdb=False</em>, <em>ostream=None</em>, <em>tb_offset=0</em>, <em>long_header=False</em>, <em>include_vars=False</em>, <em>check_cache=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.FormattedTB.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.FormattedTB.set_mode">
<tt class="descname">set_mode</tt><big>(</big><em>mode=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.FormattedTB.set_mode" title="Permalink to this definition">¶</a></dt>
<dd><p>Switch to the desired mode.</p>
<p>If mode is not specified, cycles through the available modes.</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.FormattedTB.stb2text">
<tt class="descname">stb2text</tt><big>(</big><em>stb</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.FormattedTB.stb2text" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a structured traceback (a list) to a string.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.core.ultratb.AutoFormattedTB">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">AutoFormattedTB</tt><big>(</big><em>mode=u'Plain'</em>, <em>color_scheme=u'Linux'</em>, <em>call_pdb=False</em>, <em>ostream=None</em>, <em>tb_offset=0</em>, <em>long_header=False</em>, <em>include_vars=False</em>, <em>check_cache=None</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.AutoFormattedTB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.core.ultratb.FormattedTB" title="IPython.core.ultratb.FormattedTB"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.FormattedTB</span></tt></a></p>
<p>A traceback printer which can be called on the fly.</p>
<p>It will find out about exceptions by itself.</p>
<p>A brief example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">AutoTB</span> <span class="o">=</span> <span class="n">AutoFormattedTB</span><span class="p">(</span><span class="n">mode</span> <span class="o">=</span> <span class="s">&#39;Verbose&#39;</span><span class="p">,</span><span class="n">color_scheme</span><span class="o">=</span><span class="s">&#39;Linux&#39;</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
  <span class="o">...</span>
<span class="k">except</span><span class="p">:</span>
  <span class="n">AutoTB</span><span class="p">()</span>  <span class="c"># or AutoTB(out=logfile) where logfile is an open file object</span>
</pre></div>
</div>
</dd></dl>

<dl class="class">
<dt id="IPython.core.ultratb.ColorTB">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">ColorTB</tt><big>(</big><em>color_scheme=u'Linux'</em>, <em>call_pdb=0</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ColorTB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.core.ultratb.FormattedTB" title="IPython.core.ultratb.FormattedTB"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.FormattedTB</span></tt></a></p>
<p>Shorthand to initialize a FormattedTB in Linux colors mode.</p>
<dl class="method">
<dt id="IPython.core.ultratb.ColorTB.__init__">
<tt class="descname">__init__</tt><big>(</big><em>color_scheme=u'Linux'</em>, <em>call_pdb=0</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.ColorTB.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="IPython.core.ultratb.SyntaxTB">
<em class="property">class </em><tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">SyntaxTB</tt><big>(</big><em>color_scheme=u'NoColor'</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.SyntaxTB" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#IPython.core.ultratb.ListTB" title="IPython.core.ultratb.ListTB"><tt class="xref py py-class docutils literal"><span class="pre">IPython.core.ultratb.ListTB</span></tt></a></p>
<p>Extension which holds some state: the last exception value</p>
<dl class="method">
<dt id="IPython.core.ultratb.SyntaxTB.__init__">
<tt class="descname">__init__</tt><big>(</big><em>color_scheme=u'NoColor'</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.SyntaxTB.__init__" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.SyntaxTB.clear_err_state">
<tt class="descname">clear_err_state</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.core.ultratb.SyntaxTB.clear_err_state" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current error state and clear it</p>
</dd></dl>

<dl class="method">
<dt id="IPython.core.ultratb.SyntaxTB.stb2text">
<tt class="descname">stb2text</tt><big>(</big><em>stb</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.SyntaxTB.stb2text" title="Permalink to this definition">¶</a></dt>
<dd><p>Convert a structured traceback (a list) to a string.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="functions">
<h2>4 Functions<a class="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="IPython.core.ultratb.inspect_error">
<tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">inspect_error</tt><big>(</big><big>)</big><a class="headerlink" href="#IPython.core.ultratb.inspect_error" title="Permalink to this definition">¶</a></dt>
<dd><p>Print a message about internal inspect errors.</p>
<p>These are unfortunately quite common.</p>
</dd></dl>

<dl class="function">
<dt id="IPython.core.ultratb.findsource">
<tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">findsource</tt><big>(</big><em>object</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.findsource" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the entire source file and starting line number for an object.</p>
<p>The argument may be a module, class, method, function, traceback, frame,
or code object.  The source code is returned as a list of all the lines
in the file and the line number indexes a line in that list.  An IOError
is raised if the source code cannot be retrieved.</p>
<p>FIXED version with which we monkeypatch the stdlib to work around a bug.</p>
</dd></dl>

<dl class="function">
<dt id="IPython.core.ultratb.with_patch_inspect">
<tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">with_patch_inspect</tt><big>(</big><em>f</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.with_patch_inspect" title="Permalink to this definition">¶</a></dt>
<dd><p>decorator for monkeypatching inspect.findsource</p>
</dd></dl>

<dl class="function">
<dt id="IPython.core.ultratb.fix_frame_records_filenames">
<tt class="descclassname">IPython.core.ultratb.</tt><tt class="descname">fix_frame_records_filenames</tt><big>(</big><em>records</em><big>)</big><a class="headerlink" href="#IPython.core.ultratb.fix_frame_records_filenames" title="Permalink to this definition">¶</a></dt>
<dd><p>Try to fix the filenames in each record from inspect.getinnerframes().</p>
<p>Particularly, modules loaded from within zip files have useless filenames
attached to their code object, and inspect.getinnerframes() just uses it.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="IPython.core.usage.html" title="Module: core.usage"
             >next</a> |</li>
        <li class="right" >
          <a href="IPython.core.splitinput.html" title="Module: core.splitinput"
             >previous</a> |</li>
        <li><a href="http://ipython.org">home</a>|&nbsp;</li>
        <li><a href="../../search.html">search</a>|&nbsp;</li>
       <li><a href="../../index.html">documentation </a> &raquo;</li>

          <li><a href="../index.html" >The IPython API</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright The IPython Development Team.
      Last updated on Jul 14, 2015.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
    </div>
  </body>
</html>