Registry / observability / raven
library6.10.0pypypi✓ verified 26d ago

Raven is the legacy Python client for Sentry, providing error and exception tracking for Python applications. It offers integrations for frameworks like Django and Flask, and supports general WSGI applications. The library is currently in maintenance mode, with new feature development and most bug fixes now occurring exclusively in the successor `sentry-sdk` library.

pip install raven
INSTALL
IMPORT
SIG · RAVEN
R
raven
observabilitypythonv6.10.0
Install
1.6s avg
Import
155ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v6.10.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.162s · 19.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.148s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
from raven import Client
captureException
client.captureException()
sentry_sdk.capture_exception()
The `sentry_sdk` library uses a different API for capturing exceptions.

This quickstart demonstrates how to initialize the Raven client with a DSN and then capture an exception and a simple message. Replace the placeholder DSN with your actual Sentry DSN.

import os from raven import Client # Get your DSN from Sentry (e.g., from environment variables) dsn = os.environ.get('SENTRY_DSN', 'https://examplePublicKey@o0.ingest.sentry.io/0') # Initialize the Raven client client = Client(dsn) try: 1 / 0 except ZeroDivisionError: client.captureException() print("Error captured by Raven (check your Sentry dashboard).") client.captureMessage('This is a test message from Raven.') print("Message captured by Raven.")
Debug
Known issues
breakingRaven is the legacy Sentry client and is largely deprecated in favor of `sentry-sdk`. New projects should use `sentry-sdk` for an improved experience and all new features. Migrating from `raven` to `sentry-sdk` involves significant API changes.
fix
For new projects, use `pip install sentry-sdk` and follow its documentation. For existing Raven users, consult the official Sentry migration guide from Raven to `sentry-sdk`.
affects: All versions of Raven (since `sentry-sdk` release)
breakingThe `raven.conf.load` function was removed, and binding transports via a scheme prefix on DSNs was deprecated in version 5.4.0. The `aiohttp` transport was also moved to a separate `raven-aiohttp` package.
fix
Adjust configuration to use direct `Client` instantiation with DSN and explicitly configure transports if needed, using `raven-aiohttp` for aiohttp integration.
affects: >=5.4.0
breakingThe UDP transport was removed in version 5.3.0. Additionally, server configuration *must* now be specified with a DSN.
fix
Ensure your Sentry DSN is correctly configured and avoid using UDP transport options. Use a DSN for all server configurations.
affects: >=5.3.0
gotchaIn Raven versions prior to 6.10.0, stackframes in some situations could be in inverse order, and `NaN` local variables might be sent as non-standard JSON, potentially causing issues with Sentry event processing.
fix
Upgrade to Raven 6.10.0 or later to ensure correct stackframe order and proper handling of `NaN` local variables. If migrating to `sentry-sdk` is not an immediate option, ensure you are on the latest `raven` release.
affects: <6.10.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'raven'
The 'raven' library is not installed in your current Python environment.
fix
pip install raven
ValueError: Invalid DSN: Missing protocol
The Data Source Name (DSN) provided for Sentry is malformed or incomplete, specifically missing the protocol part (e.g., 'https://').
fix
Ensure your DSN starts with a valid protocol, like 'https://public_key@sentry.io/project_id'.
ModuleNotFoundError: No module named 'raven.contrib.django'
The specific 'contrib' package for framework integration (e.g., Django) is not installed, or the import path is incorrect.
fix
Install the correct extra with `pip install raven[django]` (or `[flask]`, etc.) or verify your import statement.
AttributeError: 'Client' object has no attribute 'capture_exception'
You are attempting to use a method (`capture_exception`) that exists in the successor `sentry-sdk` library but not in `raven`; `raven` uses `captureException` (camelCase).
fix
Use `client.captureException()` instead of `client.capture_exception()`, or consider migrating to `sentry-sdk`.
AttributeError: module 'raven' has no attribute 'Client'
The 'Client' class is attempted to be accessed as 'raven.Client' instead of being imported directly from the 'raven' package.
fix
from raven import Client
Upgrade
Version history
6.10.0latest on PyPI · released Dec 19, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
15
OpenAI (training)
2
Resources
raven — pip install raven · libregistry