Skip to main content

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


Download files

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

Source Distribution

tinycrashreporter-1.0.3.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file tinycrashreporter-1.0.3.tar.gz.

File metadata

File hashes

Hashes for tinycrashreporter-1.0.3.tar.gz
Algorithm Hash digest
SHA256 6ad649673cceadb77f18d70fcc2ecf4ae06e4ea8ba6d8713355b7185e8ac6e90
MD5 26ef3c936344fa0e60353b20fef3b117
BLAKE2b-256 e2d3c446641a806b41207a8dc457e38b6fdc782d39505f61bb25ff383a1b2934

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page