Pretty and useful exceptions in Python, automatically.

Overview

better-exceptions Travis

Pretty and more helpful exceptions in Python, automatically.

Example screenshot of exceptions

Usage

Install better_exceptions via pip:

$ pip install better_exceptions

And set the BETTER_EXCEPTIONS environment variable to any value:

export BETTER_EXCEPTIONS=1  # Linux / OSX
setx BETTER_EXCEPTIONS 1    # Windows

That's it!

Python REPL (Interactive Shell)

In order to use better_exceptions in the Python REPL, first install the package (as instructed above) and run:

$ python -m better_exceptions
Type "help", "copyright", "credits" or "license" for more information.
(BetterExceptionsConsole)
>>>

in order to drop into a better_exceptions-enabled Python interactive shell.

Advanced Usage

If you want to allow the entirety of values to be outputted instead of being truncated to a certain amount of characters:

import better_exceptions
better_exceptions.MAX_LENGTH = None

While using better_exceptions in production, do not forget to unset the BETTER_EXCEPTIONS variable to avoid leaking sensitive data in your logs.

Use with unittest

If you want to use better_exceptions to format unittest's exception output, you can use the monkey patch below:

import sys
import unittest
import better_exceptions

def patch(self, err, test):
    lines = better_exceptions.format_exception(*err)
    if sys.version_info[0] == 2:
        return u"".join(lines).encode("utf-8")
    return "".join(lines)

unittest.result.TestResult._exc_info_to_string = patch

Note that this uses an undocumented method override, so it is not guaranteed to work on all platforms or versions of Python.

Django Usage

In settings.py, add your new class to the MIDDLEWARE setting and update your logging configuration:

# ...

MIDDLEWARE = [
    # ...
    "better_exceptions.integrations.django.BetterExceptionsMiddleware",
]

# ...

from better_exceptions.integrations.django import skip_errors_filter

# if you don't want to override LOGGING because you want to change the default,
# you can vendor Django's default logging configuration and update it for 
# better-exceptions. the default for Django 3.1.4 can be found here:
# https://github.com/django/django/blob/3.1.4/django/utils/log.py#L13-L63
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'skip_errors': {
            '()': 'django.utils.log.CallbackFilter',
            'callback': skip_errors_filter,
        }
    },
    'handlers': {
        'console': {
            'level': 'INFO',
            # without the 'filters' key, Django will log errors twice:
            # one time from better-exceptions and one time from Django.
            # with the 'skip_errors' filter, we remove the repeat log
            # from Django, which is unformatted.
            'filters': ['skip_errors'],
            'class': 'logging.StreamHandler',
        }
    },
    'loggers': {
        'django': {
            'handlers': [
                'console',
            ],
        }
    }
}

example output:

image

Troubleshooting

If you do not see beautiful exceptions, first make sure that the environment variable does exist. You can try echo $BETTER_EXCEPTIONS (Linux / OSX) or echo %BETTER_EXCEPTIONS% (Windows). On Linux and OSX, the export command does not add the variable permanently, you will probably need to edit the ~/.profile file to make it persistent. On Windows, you need to open a new terminal after the setx command.

Check that there is no conflict with another library, and that the sys.excepthook function has been correctly replaced with the better_exceptions's one. Sometimes other components can set up their own exception handlers, such as the python3-apport Ubuntu package that you may need to uninstall.

Make sure that you have not inadvertently deleted the better_exceptions_hook.pth file that should be in the same place as the better_exceptions folder where all of your Python packages are installed. Otherwise, try re-installing better_exceptions.

You can also try to manually activate the hook by adding import better_exceptions; better_exceptions.hook() at the beginning of your script.

Finally, if you still can not get this module to work, open a new issue by describing your problem precisely and detailing your configuration (Python and better_exceptions versions, OS, code snippet, interpeter, etc.) so that we can reproduce the bug you are experiencing.

License

Copyright © 2017, Josh Junon. Licensed under the MIT license.

Comments
  • Define license on pypi

    Define license on pypi

    Define the license for this project on pypi so that it can be automated e.g. package import by guix users

    kreyren@dreamon ~$ guix import pypi better-exceptions
    
    Starting download of /tmp/guix-file.HIExkY
    From https://files.pythonhosted.org/packages/26/d8/30b745b965765c08ee132fd590fca46c31296e8f1a606de0c53cc6b5a68f/better_exceptions-0.3.3.tar.gz...
     …ns-0.3.3.tar.gz  29KiB              2.6MiB/s 00:00 [##################] 100.0%
    
    Starting download of /tmp/guix-file.O3ArzJ
    From https://files.pythonhosted.org/packages/ed/50/abf6850135f1e95d321a525d0a36e05255a039b3fc118b7d88413e8a8207/better_exceptions-0.3.3-py3-none-any.whl...
     …3.3-py3-none-any.whl  12KiB         2.6MiB/s 00:00 [##################] 100.0%
    guix import: warning: Failed to extract file: better_exceptions-0.3.3.dist-info/METADATA from wheel.
    (package
      (name "python-better-exceptions")
      (version "0.3.3")
      (source (origin
                (method url-fetch)
                (uri (pypi-uri "better_exceptions" version))
                (sha256
                 (base32
                  "0fs5nfg7xdbx5hb1h1148kax68g9wn0h7cclx3k08psd8hcbrrp4"))))
      (build-system python-build-system)
      (home-page "https://github.com/qix-/better-exceptions")
      (synopsis "Pretty and helpful exceptions, automatically")
      (description "Pretty and helpful exceptions, automatically")
      # required field (license license:expat) missing due to it not being defined in pypi
    
    opened by Kreyren 1
  • f_lineno not an attribute on traceback

    f_lineno not an attribute on traceback

    I'm not sure exactly where this issue comes from, but I see it with better_tracebacks enabled, and not, without it.

    I'm not sure if it's in better exceptions, celery or python 3.8

    ...
    [2022-06-16 16:22:50,321: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/better_exceptions/formatter.py", line 209, in get_traceback_information
        frame_info = inspect.getframeinfo(tb)
    [2022-06-16 16:22:50,321: WARNING/MainProcess]   File "/usr/local/lib/python3.8/inspect.py", line 1469, in getframeinfo
        lineno = frame.f_lineno
    [2022-06-16 16:22:50,321: WARNING/MainProcess] AttributeError: 'Traceback' object has no attribute 'f_lineno'
    [2022-06-16 16:22:50,321: WARNING/MainProcess] Call stack:
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/bin/celery", line 8, in <module>
        sys.exit(main())
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/__main__.py", line 15, in main
        sys.exit(_main())
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/bin/celery.py", line 217, in main
        return celery(auto_envvar_prefix="CELERY")
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
        return self.main(*args, **kwargs)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/click/core.py", line 1055, in main
        rv = self.invoke(ctx)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
        return ctx.invoke(self.callback, **ctx.params)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/click/core.py", line 760, in invoke
        return __callback(*args, **kwargs)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func
        return f(get_current_context(), *args, **kwargs)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/bin/base.py", line 134, in caller
        return f(ctx, *args, **kwargs)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/bin/worker.py", line 351, in worker
        worker.start()
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/worker.py", line 203, in start
        self.blueprint.start(self)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
        step.start(parent)
    [2022-06-16 16:22:50,326: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/bootsteps.py", line 365, in start
        return self.obj.start()
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 332, in start
        blueprint.start(self)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/bootsteps.py", line 116, in start
        step.start(parent)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 628, in start
        c.loop(*c.loop_args())
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/loops.py", line 97, in asynloop
        next(loop)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/asynchronous/hub.py", line 362, in create_loop
        cb(*cbargs)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/transport/redis.py", line 1326, in on_readable
        self.cycle.on_readable(fileno)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/transport/redis.py", line 562, in on_readable
        chan.handlers[type]()
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/transport/redis.py", line 967, in _brpop_read
        self.connection._deliver(loads(bytes_to_str(item)), dest)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/transport/virtual/base.py", line 991, in _deliver
        callback(message)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/transport/virtual/base.py", line 624, in _callback
        return callback(message)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/kombu/messaging.py", line 626, in _receive_callback
        return on_m(message) if on_m else self.receive(decoded, message)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/consumer/consumer.py", line 596, in on_task_received
        strategy(
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/strategy.py", line 207, in task_message_handler
        handle(req)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/worker.py", line 226, in _process_task
        req.execute_using_pool(self.pool)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/worker/request.py", line 707, in execute_using_pool
        result = apply_async(
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/concurrency/base.py", line 152, in apply_async
        return self.on_apply(target, args, kwargs,
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/concurrency/base.py", line 29, in apply_target
        ret = target(*args, **kwargs)
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/app/trace.py", line 649, in fast_trace_task
        R, I, T, Rstr = tasks[task].__trace__(
    [2022-06-16 16:22:50,327: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/app/trace.py", line 468, in trace_task
        I, R, state, retval = on_error(task_request, exc, uuid)
    [2022-06-16 16:22:50,328: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/app/trace.py", line 379, in on_error
        R = I.handle_error_state(
    [2022-06-16 16:22:50,328: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/app/trace.py", line 178, in handle_error_state
        return {
    [2022-06-16 16:22:50,328: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/app/trace.py", line 237, in handle_failure
        self._log_error(task, req, einfo)
    [2022-06-16 16:22:50,328: WARNING/MainProcess]   File "/home/stu/.virtualenvs/dit-tamato/lib/python3.8/site-packages/celery/app/trace.py", line 265, in _log_error
        logger.log(policy.severity, policy.format.strip(), context,
    ...
    
    opened by stuaxo 0
  • terminfo (tmux-256color, xterm-256color) not considered to be valid

    terminfo (tmux-256color, xterm-256color) not considered to be valid

    Using /usr/lib/terminfo/t/tmux-256color from ncurses 6.2-2 (on Arch Linux) color support (SUPPORTS_COLOR) is not detected properly.

    [38] > …/Vcs/better-exceptions/better_exceptions/color.py(106)<module>()->None
    
    ...
     99             if is_tty:
    100                 f = get_terminfo_file()
    101                 if f is not None:
    102                     with f:
    103                         # f is a valid terminfo; seek and read!
    104                         magic_number = struct.unpack('<h', f.read(2))[0]
    105
    106  ->                     if magic_number == 0x11A:
    107                             # the opened terminfo file is valid.
    108                             offset = 2 + 10  # magic number + size section (the next thing we read fr
    109                             offset += struct.unpack('<h', f.read(2))[0]  # skip over names section
    110                             offset += struct.unpack('<h', f.read(2))[0]  # skip over bool section
    111                             offset += offset % 2  # align to short boundary
    112                             offset += 13 * 2  # maxColors is the 13th numeric value
    113
    114                             f.seek(offset)
    115                             max_colors = struct.unpack('<h', f.read(2))[0]
    116
    117                             if max_colors >= 8:
    118                                 SUPPORTS_COLOR = True
     return None
    (Pdb++) f
    <_io.BufferedReader name='/usr/lib/terminfo/t/tmux-256color'>
    (Pdb++) magic_number
    542
    (Pdb++) 0x11A
    282
    

    This also happens with /usr/lib/terminfo/x/xterm-256color (magic_number also being 542).

    Using better-exceptions 0.3.3-1-g70e282d.

    bug 
    opened by blueyed 5
  • weird escape chars instead of lines

    weird escape chars instead of lines

    two problems:

    1. I just installed with pip and ran a test script for hook. Odd results. This is in Windows 10 command line:
    (utils) C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python>pip install frosch
    Collecting frosch
      Downloading frosch-0.1.7-py3-none-any.whl (14 kB)
    Collecting asttokens<3.0.0,>=2.0.4
      Downloading asttokens-2.0.4-py2.py3-none-any.whl (20 kB)
    Requirement already satisfied: six in c:\users\gil\envs\utils\lib\site-packages (from asttokens<3.0.0,>=2.0.4->frosch) (1.15.0)
    Collecting colorama<0.5.0,>=0.4.4
      Downloading colorama-0.4.4-py2.py3-none-any.whl (16 kB)
    Collecting Pygments<3.0.0,>=2.7.2
      Downloading Pygments-2.7.3-py3-none-any.whl (950 kB)
         |████████████████████████████████| 950 kB 2.2 MB/s
    Collecting pytest-sugar<0.10.0,>=0.9.4
      Downloading pytest-sugar-0.9.4.tar.gz (12 kB)
    Requirement already satisfied: termcolor>=1.1.0 in c:\users\gil\envs\utils\lib\site-packages (from pytest-sugar<0.10.0,>=0.9.4->frosch) (1.1.0)
    Requirement already satisfied: packaging>=14.1 in c:\users\gil\envs\utils\lib\site-packages (from pytest-sugar<0.10.0,>=0.9.4->frosch) (20.4)
    Requirement already satisfied: pyparsing>=2.0.2 in c:\users\gil\envs\utils\lib\site-packages (from packaging>=14.1->pytest-sugar<0.10.0,>=0.9.4->frosch) (2.4.7)
    Collecting pytest>=2.9
      Downloading pytest-6.2.1-py3-none-any.whl (279 kB)
         |████████████████████████████████| 279 kB 3.2 MB/s
    Requirement already satisfied: attrs>=19.2.0 in c:\users\gil\envs\utils\lib\site-packages (from pytest>=2.9->pytest-sugar<0.10.0,>=0.9.4->frosch) (19.3.0)
    Requirement already satisfied: toml in c:\users\gil\envs\utils\lib\site-packages (from pytest>=2.9->pytest-sugar<0.10.0,>=0.9.4->frosch) (0.10.1)
    Collecting atomicwrites>=1.0
      Downloading atomicwrites-1.4.0-py2.py3-none-any.whl (6.8 kB)
    Collecting pluggy<1.0.0a1,>=0.12
      Downloading pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
    Collecting py>=1.8.2
      Downloading py-1.10.0-py2.py3-none-any.whl (97 kB)
         |████████████████████████████████| 97 kB 3.2 MB/s
    Collecting stack-data<0.2.0,>=0.1.0
      Downloading stack_data-0.1.0-py3-none-any.whl (20 kB)
    Collecting yapf<0.31.0,>=0.30.0
      Downloading yapf-0.30.0-py2.py3-none-any.whl (190 kB)
         |████████████████████████████████| 190 kB 3.3 MB/s
    Collecting executing
      Downloading executing-0.5.4-py3-none-any.whl (12 kB)
    Collecting iniconfig
      Downloading iniconfig-1.1.1-py2.py3-none-any.whl (5.0 kB)
    Collecting pure-eval
      Downloading pure_eval-0.1.1-py3-none-any.whl (9.4 kB)
    Building wheels for collected packages: pytest-sugar
      Building wheel for pytest-sugar (setup.py) ... done
      Created wheel for pytest-sugar: filename=pytest_sugar-0.9.4-py2.py3-none-any.whl size=8977 sha256=450a8aee9c6f1418955904f4d15e157340f920f76b40aa093f652d3e3880ce9f
      Stored in directory: c:\users\gil\appdata\local\pip\cache\wheels\11\15\a5\18fe38a58318bf4aa4bc15c369d8dd7ec9210164812c48b8ba
    Successfully built pytest-sugar
    Installing collected packages: py, pluggy, iniconfig, colorama, atomicwrites, pytest, pure-eval, executing, asttokens, yapf, stack-data, pytest-sugar, Pygments, frosch
      Attempting uninstall: colorama
        Found existing installation: colorama 0.4.3
        Uninstalling colorama-0.4.3:
          Successfully uninstalled colorama-0.4.3
      Attempting uninstall: Pygments
        Found existing installation: Pygments 2.6.1
        Uninstalling Pygments-2.6.1:
          Successfully uninstalled Pygments-2.6.1
    Successfully installed Pygments-2.7.3 asttokens-2.0.4 atomicwrites-1.4.0 colorama-0.4.4 executing-0.5.4 frosch-0.1.7 iniconfig-1.1.1 pluggy-0.13.1 pure-eval-0.1.1 py-1.10.0 pytest-6.2.1 pytest-sugar-0.9.4 stack-data-0.1.0 yapf-0.30.0
    
    (utils) C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python>p test_frosch.py
    Traceback (most recent call last):
      File "C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python\test_frosch.py", line 4, in <module>
        x = 3 + 'asdf'
    TypeError: unsupported operand type(s) for +: 'int' and 'str'
    
     4 || x = 3 + 'asdf'
       || │
       || └── x = None
       ||
    
    

    Here's the code of test_frosch.py:

    from frosch import hook
    
    # hook(theme='vim')
    hook()
    x = 3 + 'asdf'
    

    When I try to run with IPython inside nvim Terminal -- nothing happens at all (as if the hook() does not, well, hook):

    (utils) C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python
    >ipython --pprint
    Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 17:08:21) [MSC v.1927 64 bit
    Type 'copyright', 'credits' or 'license' for more information
    IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.
    
    In [4]: %run "C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities
       ...: \Python\test_frosch.py"
    ---------------------------------------------------------------------------
    TypeError                                 Traceback (most recent call last)
    C:\Dropbox\Documents_and_Writings\Research\Digital_Humanities\Python\test_frosch
    .py in <module>
          3 # hook(theme='vim')
          4 hook()
    ----> 5 x = 3 + 'asdf'
    
    TypeError: unsupported operand type(s) for +: 'int' and 'str'
    
    In [5]:
    

    Thanks!

    opened by gilbh 5
  • threading.excepthook new in python 3.8

    threading.excepthook new in python 3.8

    currently better_exceptions.hook() patches sys.excepthook and logging modules. It will be perfect to set the same for threads as well.

    doc: https://docs.python.org/3/library/threading.html#threading.excepthook

    opened by jnoortheen 0
  • Not working with ~/.python_history

    Not working with ~/.python_history

    Hi,

    I noticed that on my system the interactive console launched as python3 -m better_exceptions does not interact with ~/.python_history—i.e., neither old commands can be retrieved by pressing the arrow up key, nor do executed commands get appended to ~/.python_history.

    Example:

    15992249591

    1. Most recent command is a = 1
    2. In an interactive shell started as python3, pressing up results in a = 1 showing up.
    3. In an interactive shell started as python3 -m better_exceptions, arrow up is not understood.
    4. Execute b = 2 in a shell started with -m better_exceptions and close shell.
    5. b = 2 is not stored in ~/.python_history.
    opened by IllDepence 0
Releases(0.2.1)
  • 0.2.1(Jan 16, 2018)

    Starting this release out by mentioning the real MVP @Delgan for all of their help with the latest version of better_exceptions, and for all of the recent support. This release is mainly composed of his work.

    This release changes the usage slightly (in a backwards compatible manner):

    • No longer do you need to import better_exceptions - the import hook has been baked into the package and thus pip install better_exceptions and export BETTER_EXCEPTIONS=1 is all that is necessary (see the README for more information)
    • Several bugfixes have been merged and a lot of improvements have been made to portability and text encoding

    This release has been published to pypi as better_exceptions==0.2.1.

    Source code(tar.gz)
    Source code(zip)
  • 0.1.8(May 12, 2017)

Owner
Qix
@wavetilt, @terralang, @chalk, formerly @uber, @zeit/@vercel
Qix
Pretty-print tabular data in Python, a library and a command-line utility. Repository migrated from bitbucket.org/astanin/python-tabulate.

python-tabulate Pretty-print tabular data in Python, a library and a command-line utility. The main use cases of the library are: printing small table

Sergey Astanin 1.5k Jan 6, 2023
A small utility to pretty-print Python tracebacks. ⛺

TBVaccine TBVaccine is a utility that pretty-prints Python tracebacks. It automatically highlights lines you care about and deemphasizes lines you don

Stavros Korokithakis 365 Nov 11, 2022
Log processor for nginx or apache that extracts user and user sessions and calculates other types of useful data for bot detection or traffic analysis

Log processor for nginx or apache that extracts user and user sessions and calculates other types of useful data for bot detection or traffic analysis

David Puerta Martín 1 Nov 11, 2021
Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"

Text progress bar library for Python. Travis status: Coverage: Install The package can be installed through pip (this is the recommended method): pip

Rick van Hattem 795 Dec 18, 2022
ClusterMonitor - a very simple python script which monitors and records the CPU and RAM consumption of submitted cluster jobs

ClusterMonitor A very simple python script which monitors and records the CPU and RAM consumption of submitted cluster jobs. Usage To start recording

null 23 Oct 4, 2021
Robust and effective logging for Python 2 and 3.

Robust and effective logging for Python 2 and 3.

Chris Hager 1k Jan 4, 2023
A Fast, Extensible Progress Bar for Python and CLI

tqdm tqdm derives from the Arabic word taqaddum (تقدّم) which can mean "progress," and is an abbreviation for "I love you so much" in Spanish (te quie

tqdm developers 23.7k Jan 1, 2023
Rich is a Python library for rich text and beautiful formatting in the terminal.

Rich 中文 readme • lengua española readme • Läs på svenska Rich is a Python library for rich text and beautiful formatting in the terminal. The Rich API

Will McGugan 41.5k Jan 7, 2023
Beautifully colored, quick and simple Python logging

Python Quick Logging | QLogging Beautifully colored, quick and simple Python logging. This logger is based on Python logging package Screenshots: Term

null 45 Sep 25, 2022
Fancy console logger and wise assistant within your python projects

Fancy console logger and wise assistant within your python projects. Made to save tons of hours for common routines.

BoB 5 Apr 1, 2022
Simple and versatile logging library for python 3.6 above

Simple and versatile logging library for python 3.6 above

Miguel 1 Nov 23, 2022
Monitor and log Network and Disks statistics in MegaBytes per second.

iometrics Monitor and log Network and Disks statistics in MegaBytes per second. Install pip install iometrics Usage Pytorch-lightning integration from

Leo Gallucci 17 May 3, 2022
Python logging made (stupidly) simple

Loguru is a library which aims to bring enjoyable logging in Python. Did you ever feel lazy about configuring a logger and used print() instead?... I

null 13.7k Jan 2, 2023
The new Python SDK for Sentry.io

sentry-python - Sentry SDK for Python This is the next line of the Python SDK for Sentry, intended to replace the raven package on PyPI. from sentry_s

Sentry 1.4k Dec 31, 2022
Structured Logging for Python

structlog makes logging in Python faster, less painful, and more powerful by adding structure to your log entries. It's up to you whether you want str

Hynek Schlawack 2.3k Jan 5, 2023
Json Formatter for the standard python logger

Overview This library is provided to allow standard python logging to output log data as json objects. With JSON we can make our logs more readable by

Zakaria Zajac 1.4k Jan 4, 2023
A colored formatter for the python logging module

Log formatting with colors! colorlog.ColoredFormatter is a formatter for use with Python's logging module that outputs records using terminal colors.

Sam Clements 778 Dec 26, 2022
Colored terminal output for Python's logging module

coloredlogs: Colored terminal output for Python's logging module The coloredlogs package enables colored terminal output for Python's logging module.

Peter Odding 496 Dec 30, 2022
Prettify Python exception output to make it legible.

pretty-errors Prettifies Python exception output to make it legible. Install it with python -m pip install pretty_errors If you want pretty_errors to

Iain King 2.6k Jan 4, 2023