Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

A Python library to log any exceptions to standard out.

Project description

This library is designed to print any exceptions which a Python program encounters when it is run to standard out.

Install:

In terminal run -> pip3 install tinycrashreporter

This is enough to get the modlue working as it should. However, to run the samples and unit tests. Also…

Navigate to the location that you want to keep the package.

In terminal run -> pip download tinycrashreporter

Then in the same folder…

In terminal run-> tar -xvzf tinycrashreporter-1.0.3.tar.gz to extract the downloaded files.

You’re ready to get started!

The library code also workes in Python 2.7 but there is not yet a PIP package for that one.

Setup:

  1. Import both sys and the tinycrashreporter library into your program.
  2. Add the line -> sys.excepthook = tinycrashreporter.crashReportExceptHook <- bellow your imports.
  3. In terminal run-> Python3 ~/PythonFiles/MyTinyCrashReporterProgram.py

Warning: IDLE and other IDE’s appear to use the same method override as Tiny Crash Reporter and are not currently supported. Please run from a command line instead.

Example:

Add the following lines of code into a blank python file.

#!/usr/bin/env python
# set up tiny crash reporter:
import sys
import (...any_other_module...)
import tinycrashreporter

sys.excepthook  = tinycrashreporter.crashReportExceptHook

# Add some crashy code
1/0

Blank file:

A blank file, which includes the code above and conforms to the specification has been included DownloadedPackageLocation/Samples/ImportedLibraryOnly.py

In teminal run -> python3 ImportedLibraryOnly.py

File with options:

A file DownloadedPackageLocation/SamplesCrashyProgram.py has also been set up which supports the execution of code passed as an argument. This is for testing purposes and this code should not be published as part of a release project due to its inherent insecurities.

In terminal run -> python3 CrashyProgram.py

Unit tests:

8 Tests are available in DownloadedPackageLocation/Samples/CrashTest.py. To run these, open DownloadedPackageLocation/Tests/CrashTest.py manually edit the file path to point to DownloadedPackageLocation/Tests/CrashyProgram.py. Then…

In terminal run -> python3 ~/SampleLocation/CrashTest.py -v

One of the tests requests user to input some crashy code. This facility doesn’t work with ” or ‘ characters and the inclusion of some other special characters may cause similar errors. More work is needed to properly escape the input. If in doubt, the default test will run on pressing enter.

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tinycrashreporter, version 1.0.3
Filename, size File type Python version Upload date Hashes
Filename, size tinycrashreporter-1.0.3.tar.gz (8.3 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page