html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,issue,performed_via_github_app
https://github.com/simonw/datasette/issues/1979#issuecomment-1374582375,https://api.github.com/repos/simonw/datasette/issues/1979,1374582375,IC_kwDOBm6k_c5R7nZn,9599,2023-01-07T19:22:39Z,2023-01-07T19:22:39Z,OWNER,"This helps:
```diff
diff --git a/datasette/cli.py b/datasette/cli.py
index 2b61292b..ea98879c 100644
--- a/datasette/cli.py
+++ b/datasette/cli.py
@@ -4,13 +4,15 @@ import click
from click import formatting
from click.types import CompositeParamType
from click_default_group import DefaultGroup
+import functools
import json
import os
import pathlib
import shutil
from subprocess import call
-import sys
from runpy import run_module
+import sys
+import textwrap
import webbrowser
from .app import (
OBSOLETE_SETTINGS,
@@ -126,7 +128,7 @@ class Setting(CompositeParamType):
def sqlite_extensions(fn):
- return click.option(
+ fn = click.option(
""sqlite_extensions"",
""--load-extension"",
type=LoadExtension(),
@@ -134,6 +136,25 @@ def sqlite_extensions(fn):
multiple=True,
help=""Path to a SQLite extension to load, and optional entrypoint"",
)(fn)
+ # Wrap it in a custom error handler
+ @functools.wraps(fn)
+ def wrapped(*args, **kwargs):
+ try:
+ return fn(*args, **kwargs)
+ except AttributeError as e:
+ if ""enable_load_extension"" in str(e):
+ raise click.ClickException(
+ textwrap.dedent(
+ """"""
+ Your Python installation does not have the ability to load SQLite extensions.
+
+ More information: https://docs.datasette.io/en/stable/installation.html#extensions
+ """"""
+ ).strip()
+ )
+ raise
+
+ return wrapped
@click.group(cls=DefaultGroup, default=""serve"", default_if_no_args=True)
```
Need to write help for that to link to.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1524076587,
https://github.com/simonw/datasette/issues/1979#issuecomment-1374657204,https://api.github.com/repos/simonw/datasette/issues/1979,1374657204,IC_kwDOBm6k_c5R75q0,9599,2023-01-07T23:48:42Z,2023-01-07T23:48:42Z,OWNER,Once I ship the next release I should change that `/help/extensions` link to go to `/stable/` and not `/latest/`.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1524076587,
https://github.com/simonw/datasette/issues/1979#issuecomment-1374658468,https://api.github.com/repos/simonw/datasette/issues/1979,1374658468,IC_kwDOBm6k_c5R75-k,9599,2023-01-07T23:53:41Z,2023-01-07T23:53:41Z,OWNER,https://datasette.io/help/extensions now redirects to this new section of documentation: https://docs.datasette.io/en/latest/installation.html#a-note-about-extensions,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1524076587,
https://github.com/simonw/datasette/issues/1979#issuecomment-1374659233,https://api.github.com/repos/simonw/datasette/issues/1979,1374659233,IC_kwDOBm6k_c5R76Kh,9599,2023-01-07T23:56:25Z,2023-01-07T23:56:25Z,OWNER,"```
% datasette --load-extension foo
Error: Your Python installation does not have the ability to load SQLite extensions.
More information: https://datasette.io/help/extensions
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1524076587,
https://github.com/simonw/datasette/issues/1979#issuecomment-1374659874,https://api.github.com/repos/simonw/datasette/issues/1979,1374659874,IC_kwDOBm6k_c5R76Ui,9599,2023-01-07T23:59:11Z,2023-01-07T23:59:11Z,OWNER,I back-ported this fix to `0.63.x` as well.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",1524076587,