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