anthropics/skills · info · RuntimeError

This module should not be run directly.

Error message

This module should not be run directly.

What it means

office/validators/base.py is a library module; running it as a script (`python base.py`) hits the `if __name__ == "__main__"` guard and raises RuntimeError immediately. It has no CLI entry point — validation is invoked by importing the validator classes from a driver script.

Source

Thrown at skills/xlsx/scripts/office/validators/base.py:875

                    )
                return template_pattern.sub("", text)
            return text

        for elem in xml_copy.iter():
            if not hasattr(elem, "tag") or callable(elem.tag):
                continue
            tag_str = str(elem.tag)
            if tag_str.endswith("}t") or tag_str == "t":
                continue

            elem.text = process_text_content(elem.text, "text content")
            elem.tail = process_text_content(elem.tail, "tail content")

        return lxml.etree.ElementTree(xml_copy), warnings


if __name__ == "__main__":
    raise RuntimeError("This module should not be run directly.")

View on GitHub (pinned to f6656c1256)

Solutions

  1. Run the package's intended entry point script instead (the office/xlsx driver scripts that import these validators)
  2. If exploring, use `python -c 'from office.validators import base'` (with the scripts dir on sys.path) to import, not execute
  3. Configure IDE/CI to not execute library modules

Example fix

# before
python skills/xlsx/scripts/office/validators/base.py
# after
python skills/xlsx/scripts/office/validate.py target.docx  # (whichever driver imports base)
Defensive patterns

Strategy: try-catch

Try / catch

# Not an error to handle at runtime — correct the invocation.
# Import instead of executing: 
#   from office.validators import base

Prevention

When it happens

Trigger: Executing `python skills/xlsx/scripts/office/validators/base.py` directly from the repo root or an IDE 'run file' action; a launcher/build step globbing *.py and running each file.

Common situations: IDE run button on the open file; CI smoke tests that naively execute every .py; newcomers looking for a CLI that does not exist in this module.

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/4a87e62883d01fd5. Report an issue: GitHub.