Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install xtraceback

How to install xtraceback

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install xtraceback
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.1
0.3.3 Failed View build log
0.3.2 Failed View build log
0.3.1 Available View build log
0.3 Available View build log
0.2 Available View build log
0.1 Available View build log
Windows (64-bit)
0.3.1
0.3.3 Failed View build log
0.3.2 Failed View build log
0.3.1 Available View build log
0.3 Available View build log
0.2 Available View build log
0.1 Available View build log
Mac OS X (10.5+)
0.3.3 Available View build log
0.3.2 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2 Available View build log
0.1 Available View build log
Linux (32-bit)
0.3.3 Available View build log
0.3.2 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2 Available View build log
0.1 Available View build log
Linux (64-bit)
0.3.3 Available View build log
0.3.2 Available View build log
0.3.1 Available View build log
0.3 Available View build log
0.2 Available View build log
0.1 Available View build log
 
Author
License
MIT
Depended by
Lastest release
version 0.3.3 on Nov 10th, 2011

XTraceback is an extended Python traceback formatter with support for variable expansion and syntax highlighting.

Examples

As a context manager - the stdlib traceback module is monkey patched:

>>> import sys
>>> import traceback
>>> import xtraceback
>>>
>>> def some_func():

System Message: ERROR/3 (<string>, line 14)

Inconsistent literal block quoting.

... some_var = 2*2 ... raise Exception("exc") >>> >>> with xtraceback.StdlibCompat(): ... try: ... some_func() ... except: ... traceback.print_exc(file=sys.stdout) #doctest: +ELLIPSIS +REPORT_NDIFF Traceback (most recent call last): File "<doctest README.rst[...]>", line 3, in <module> 1 with xtraceback.StdlibCompat(): 2 try: --> 3 some_func() g:some_func = <function some_func at 0x...> g:sys = <module 'sys' (built-in)> g:traceback = <module 'traceback' from='<stdlib>/traceback.pyc'> g:xtraceback = <package 'xtraceback' from='xtraceback'> 4 except: 5 traceback.print_exc(file=sys.stdout) #doctest: +ELLIPSIS +REPORT_NDIFF File "<doctest README.rst[...]>", line 3, in some_func 1 def some_func(): 2 some_var = 2*2 --> 3 raise Exception("exc") some_var = 4 Exception: exc

As a sys.excepthook:

>>> xtraceback.compat.install_sys_excepthook()
>>> print sys.excepthook #doctest: +ELLIPSIS

System Message: ERROR/3 (<string>, line 44)

Inconsistent literal block quoting.

<bound method StdlibCompat.print_exception of <xtraceback.stdlibcompat.StdlibCompat object at 0x...>> >>> raise Exception("exc") #doctest: +ELLIPSIS Traceback (most recent call last): File "<stdlib>/doctest.py", line 1231, in __run compileflags, 1) in test.globs File "<doctest README.rst[...]>", line 1, in <module> raise Exception("exc") #doctest: +ELLIPSIS Exception: exc

By itself:

>>> try:

System Message: ERROR/3 (<string>, line 56)

Inconsistent literal block quoting.

... raise Exception("exc") ... except: ... print xtraceback.XTraceback(*sys.exc_info(), color=False) #doctest: +ELLIPSIS Traceback (most recent call last): File "<doctest README.rst[...]>", line 2, in <module> 1 try: --> 2 raise Exception("exc") g:some_func = <function some_func at 0x...> g:sys = <module 'sys' (built-in)> g:traceback = <module 'traceback' from='<stdlib>/traceback.pyc'> g:xtraceback = <package 'xtraceback' from='xtraceback'> 3 except: 4 print xtraceback.XTraceback(*sys.exc_info(), color=False) #doctest: +ELLIPSIS Exception: exc <BLANKLINE>

System Message: WARNING/2 (<string>, line 56); backlink

Inline emphasis start-string without end-string.

System Message: WARNING/2 (<string>, line 56); backlink

Inline emphasis start-string without end-string.

In a sitecustomize module:

System Message: WARNING/2 (<string>, line 74)

Literal block expected; none found.

import xtraceback xtraceback.compat.install()

Configuration

For options and their defaults see xtraceback.XTraceback's constructor. When using stdlib compat the xtraceback.StdlibCompat class has a defaults dictionary which should be updated with your overrides - the default instance exists at xtraceback.compat:

System Message: WARNING/2 (<string>, line 85)

Literal block expected; none found.

xtraceback.compat.defaults.update(option=value[, ...])

Installation

The package is on PyPI:

System Message: WARNING/2 (<string>, line 92)

Literal block expected; none found.

pip install xtraceback

Syntax highlighting depends on the pygments library:

System Message: WARNING/2 (<string>, line 96)

Literal block expected; none found.

pip install pygments

Nose plugin

The nose plugin is enabled with the --with-xtraceback flag. See nosetests --help for other options.

Subscribe to package updates

Last updated Nov 10th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.