Tracebacks please!

76 views
Skip to first unread message

Jeroen Demeyer

unread,
Oct 5, 2017, 7:22:36 AM10/5/17
to sage-devel
Hello all Sage developers,

I am getting more and more annoyed that many people tend to report bugs
(both on Trac and on the mailing list) *without* tracebacks.

Those tracebacks are often crucial information to fix a bug. For a
totally reproducible and deterministic bug, this isn't so bad since I
can always run the code myself and see what happens.

But for errors that I cannot reproduce, the traceback is what I need to
understand what is going wrong.

So, please remember: the next time you report a bug, do include the
*full* output that you get.

Maarten Derickx

unread,
Oct 5, 2017, 8:43:55 AM10/5/17
to sage-devel
I want to add to this that including both your operation system and sage version are also very useful in this respect (and sometimes even your processor type).

Fernando Perez

unread,
Oct 6, 2017, 8:15:16 PM10/6/17
to sage-devel
On Thu, Oct 5, 2017 at 5:43 AM, Maarten Derickx <m.derick...@gmail.com> wrote:
I want to add to this that including both your operation system and sage version are also very useful in this respect (and sometimes even your processor type).

Couple quick tips:


1. IPython's `%xmode verbose` automatically gives extra detailed tracebacks that are particularly useful for this:

In [25]: x=0

In [26]: y=1

In [27]: y/x
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-27-d2d3fa2acc3f> in <module>()
----> 1 y/x

ZeroDivisionError: division by zero

In [28]: %xmode verbose
Exception reporting mode: Verbose

In [29]: y/x
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-29-d2d3fa2acc3f> in <module>()
----> 1 y/x
        global y = 1
        global x = 0

ZeroDivisionError: division by zero



2. IPython's sys_info() prints system details:

In [20]: from IPython import sys_info

In [21]: print(sys_info())
{'commit_hash': '36ab971de',
 'commit_source': 'repository',
 'default_encoding': 'UTF-8',
 'ipython_path': '/Users/fperez/dev/ipython/ipython/IPython',
 'ipython_version': '6.2.0.dev',
 'os_name': 'posix',
 'platform': 'Darwin-16.7.0-x86_64-i386-64bit',
 'sys_executable': '/Users/fperez/usr/conda/bin/python',
 'sys_platform': 'darwin',
 'sys_version': '3.6.2 |Anaconda, Inc.| (default, Oct  5 2017, 03:00:07) \n'
                '[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]'}

In fact, IPython's crash handler (its internal sys.excepthook) consists more or less of a traceback made with verbose mode + the output of sys_info, and it can be very handy.

Cheers,

Reply all
Reply to author
Forward
0 new messages