anthropics / anthropics/skills

docx skill: scripts need Python 3.10+ and defusedxml, but SKILL.md declares neither

Ouverte
#1,461 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
176k
Forks
20.9k
Merge moyen
7 h 21 min
PR mergées (30 j)
5

Description

## Summary

The docx skill's Python scripts fail on macOS system Python (3.9) in two ways, and neither requirement is declared:

1. `skills/docx/scripts/merge_runs.py` imports third-party `defusedxml` (`import defusedxml.minidom`, line 33). Not preinstalled on a stock Mac, so the first failure is `ModuleNotFoundError: No module named 'defusedxml'`.
2. After installing defusedxml, the import chain still breaks on Python 3.9: `merge_runs.py` does `from office.helpers import ...`, and `skills/docx/scripts/office/helpers/__init__.py` line 24 uses PEP 604 union syntax in a signature (`-> str | None`), which raises `TypeError: unsupported operand type(s) for |` at import time on anything below 3.10. Same syntax appears in `office/helpers/pptx_chart.py` (lines 89, 101).

SKILL.md's Dependencies section lists `docx` (npm), pandoc, LibreOffice, and pdftoppm, but no Python version or Python packages, and its usage examples invoke bare `python scripts/merge_runs.py ...`. A model following the skill on a machine where `python3` is 3.9 hits two consecutive dead ends and falls back to hand-editing `word/document.xml`, which is exactly what merge_runs.py exists to make safe.

## Environment

- macOS (Darwin 25.3.0), system python3 = 3.9
- Claude Code desktop app, bundled docx skill (matches current main of this repo)

## Suggested fix (any of these)

- Declare `Python >= 3.10` and `defusedxml` in SKILL.md's Dependencies line so the model installs/selects correctly up front
- Add an early version gate in the scripts (`sys.version_info` check with a clear message) so the failure is one obvious error instead of two confusing ones
- Or drop the 3.10-only syntax (use `Optional[str]`) and fall back to stdlib `xml.dom.minidom` when defusedxml is missing, since the input is the user's own file

🤖 Filed with [Claude Code](https://claude.com/claude-code)

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start with skills/docx/SKILL.md and its Dependencies section, then inspect skills/docx/scripts/merge_runs.py and office/helpers/__init__.py for the reported requirements. Decide which suggested fix is in scope, and verify that the documented prerequisites or resulting error handling address Python 3.9 and the missing defusedxml failure.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
documentation
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
58/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.