diff --git a/datasette/handle_exception.py b/datasette/handle_exception.py
index 1a0ac979fe..96398a4c9f 100644
--- a/datasette/handle_exception.py
+++ b/datasette/handle_exception.py
@@ -5,9 +5,13 @@
)
from .views.base import DatasetteError
from markupsafe import Markup
-import pdb
import traceback
+try:
+ import ipdb as pdb
+except ImportError:
+ import pdb
+
try:
import rich
except ImportError:
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 45330a8347..c1268321f8 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -111,10 +111,14 @@ Debugging
Any errors that occur while Datasette is running while display a stack trace on the console.
-You can tell Datasette to open an interactive ``pdb`` debugger session if an error occurs using the ``--pdb`` option::
+You can tell Datasette to open an interactive ``pdb`` (or ``ipdb``, if present) debugger session if an error occurs using the ``--pdb`` option::
datasette --pdb fixtures.db
+For `ipdb `__, first run this::
+
+ datasette install ipdb
+
.. _contributing_formatting:
Code formatting
@@ -349,4 +353,4 @@ Datasette bundles `CodeMirror `__ for the SQL editing i
-p @rollup/plugin-node-resolve \
-p @rollup/plugin-terser
-* Update the version reference in the ``codemirror.html`` template.
\ No newline at end of file
+* Update the version reference in the ``codemirror.html`` template.