Zum Inhalt springen
Skillpedia
Analyse & Tabellen7.8k · #12963

python-spreadsheet-debug

Was er macht

Dieser Skill gibt dem KI-Agenten eine geordnete Reihe von Prüfungen für Tabellenaufgaben in Python. Er richtet sich an Menschen, deren Tabellenskripte scheitern und die wissen wollen, ob das Problem an der Einrichtung oder am Skript liegt.

Wann du ihn nutzt

  • ✓Wenn ein Tabellenskript fehlschlägt und die Ausgabe der Shell schwer lesbar ist.
  • ✓Wenn Python oder eine Bibliothek fehlt oder in einer falschen Version vorliegt.
  • ✓Wenn du vor dem großen Lauf einen kleinen Testlauf willst, der bestätigt, dass eine Datei lesbar ist.

Link zum Skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/python-spreadsheet-debug/SKILL.md

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/python-spreadsheet-debug/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Mein Tabellenskript scheitert ohne klaren Grund. Prüfe, ob Python und pandas funktionieren, und teste dann das Lesen der Datei.”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Der Agent prüft, welches Python er verwendet und welche Version, und importiert dann jede benötigte Bibliothek einzeln. Danach führt er ein kurzes Testskript aus, das die Datei liest und eine Zusammenfassung ausgibt, bevor der vollständige Lauf startet.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

Python Spreadsheet Debugging Workflow

When executing Python scripts for spreadsheet/data processing tasks, use this systematic debugging approach to efficiently isolate environment configuration issues from script logic errors, especially when run_shell returns opaque errors.

Step 1: Verify Python Environment

First, confirm the Python interpreter path and version to ensure you're working in the expected environment:

which python python3
python --version
python3 --version

This identifies whether Python is available and which version is being used.

Step 2: Test Library Imports in Isolation

Before running your full script, verify that required libraries can be imported successfully. Test each critical import individually:

python -c "import pandas; print('pandas:', pandas.__version__)"
python -c "import openpyxl; print('openpyxl:', openpyxl.__version__)"
python -c "import xlrd; print('xlrd:', xlrd.__version__)"

Replace library names based on your script's requirements. This identifies missing dependencies or version conflicts early.

Step 3: Run Minimal Test Script

Create and execute a minimal script that exercises only the core functionality without full business logic:

# test_minimal.py
import pandas as pd

# Test 1: Can we read a file?
try:
    df = pd.read_excel('sample.xlsx')
    print(f"✓ File read successful: {len(df)} rows")
except Exception as e:
    print(f"✗ File read failed: {e}")

# Test 2: Can we perform basic operations?
try:
    result = df.groupby('category')['amount'].sum()
    print(f"✓ GroupBy operation successful")
except Exception as e:
    print(f"✗ Operation failed: {e}")

Run this with: python test_minimal.py

Purpose: This isolates whether the issue is with file access, library functionality, or specific script logic.

Step 4: Execute Full Script

Once the minimal test passes, run the complete script:

python your_script.py

If errors occur now, you know the environment is correctly configured and can focus on debugging the specific logic.

Quick Diagnostic Command

For rapid diagnosis, run all checks in sequence:

echo "=== Python Version ===" && python --version && \
echo "=== Key Imports ===" && python -c "import pandas, openpyxl; print('OK')" && \
echo "=== Ready for full script ==="

Common Issues and Resolutions

Symptom Likely Cause Resolution
ModuleNotFoundError Missing package pip install <package-name>
ImportError with version Version conflict Check pip list, reinstall specific version
FileNotFoundError Wrong path/context Verify working directory with pwd
PermissionError File access Check file permissions or path

When to Use This Pattern

  • run_shell returns cryptic or truncated error messages
  • Script worked previously but suddenly fails
  • Deploying to a new environment or container
  • Debugging spreadsheet processing with pandas, openpyxl, xlrd, etc.

Benefits

  • Fast isolation: Identifies environment vs. logic issues within seconds
  • Incremental confidence: Each passing step narrows the problem space
  • Reusable pattern: Apply consistently across all Python spreadsheet tasks
Häufige Fragen

Warum Bibliotheken einzeln importieren?

So zeigt sich genau, welche Bibliothek fehlt oder kaputt ist, und die Lösung geht schneller.

Was macht das minimale Testskript?

Es versucht, die Tabelle zu lesen, und gibt die Zeilenzahl aus, was bestätigt, dass die Grundlagen funktionieren.

Gilt das nur für Excel-Dateien?

Nein, die Schritte gelten auch für CSV-Dateien und andere Tabellendaten.

Details

Originalbeschreibung des Autors

Systematic Python debugging workflow for spreadsheet tasks to isolate environment issues from script logic

repo: HKUDS/AgentPilot

Beliebtheit

GitHub-Sterne
7.8k
Platz im Ranking
#12963
Lizenz
MIT
Aktualisiert
1.11.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills