From ef1c0bdf7e966728777359d70c7e04d6728f2817 Mon Sep 17 00:00:00 2001 From: Mark Eaton Date: Wed, 17 Sep 2025 13:55:29 -0400 Subject: [PATCH] fix: use npx to run pa11y if not globally installed in check_wcag.py Co-authored-by: aider (o3) --- check_wcag.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/check_wcag.py b/check_wcag.py index 047c181..e648355 100644 --- a/check_wcag.py +++ b/check_wcag.py @@ -23,6 +23,7 @@ import csv import json import subprocess import sys +import shutil from pathlib import Path from typing import Dict, List, Set @@ -37,8 +38,9 @@ def run_pa11y(url: str) -> List[dict]: Returns an empty list if pa11y fails. """ try: + cmd_base = ["pa11y"] if shutil.which("pa11y") else ["npx", "pa11y"] result = subprocess.run( - ["pa11y", url, "--standard", "WCAG2AA", "--reporter", "json"], + [*cmd_base, url, "--standard", "WCAG2AA", "--reporter", "json"], capture_output=True, text=True, check=False,