Python

Sample

An example Python project configured with BugSplat exception reporting can be found here.

Installation

BugSplat recommends you use bugsplat-py with a Python virtual environment. To create a virtual environment for your project please run the following command at your project's root directory:
1
python -m venv venv
Copied!
Activate your virtual environment by running the following command:
1
# unix/macos
2
source venv/bin/activate
3
4
# windows
5
.\env\Scripts\activate
Copied!
Install the bugsplat package using pip:
1
pip install bugsplat
Copied!

Usage

Import the BugSplat class
1
from bugsplat import BugSplat
Copied!
Create a new BugSplat instance passing it the name of your BugSplat database, application, and version
1
bugsplat = BugSplat(database, application, version)
Copied!
Optionally, you set default values for key, description, email, user, and additionaFilePaths
1
bugsplat.set_default_app_key('key!')
2
bugsplat.set_default_description('description!')
3
bugsplat.set_default_email('[email protected]')
4
bugsplat.set_default_user('Fred')
5
bugsplat.set_default_additional_file_paths([
6
'./path/to/additional-file.txt',
7
'./path/to/additional-file-2.txt'
8
])
Copied!
Wrap your application code in a try/except block. In the except block call post. You can override any of the default properties that were set in step 3
1
try:
2
crash()
3
except Exception as e:
4
bugsplat.post(
5
e,
6
additional_file_paths=[],
7
app_key='other key!',
8
description='other description!',
10
user='Barney'
11
)
Copied!
Once you've posted a crash, navigate to the Crashes page and click the link in the ID column to see the crash's details
Thanks for using BugSplat ❤️
Last modified 8d ago
Copy link