Langsung ke konten
Skillpedia
Analisis & spreadsheet7.8k Β· #12963

python-spreadsheet-debug

Fungsinya

Skill ini memberi agent AI serangkaian pemeriksaan berurutan untuk tugas spreadsheet dengan Python. Skill ini ditujukan untuk orang yang skrip spreadsheet-nya gagal dan perlu mengetahui apakah masalahnya ada di pengaturan atau di skrip.

Kapan dipakai

  • βœ“Saat skrip spreadsheet gagal dan output shell sulit dibaca.
  • βœ“Saat Anda menduga Python atau pustakanya tidak terpasang atau versinya salah.
  • βœ“Saat Anda ingin menjalankan tes kecil untuk memastikan file bisa dibaca sebelum pekerjaan penuh.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/python-spreadsheet-debug/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit β†’

Contoh permintaan ke AI

β€œSkrip spreadsheet saya gagal tanpa alasan yang jelas. Periksa apakah Python dan pandas berfungsi, lalu tes membaca file.”

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memeriksa Python mana yang digunakan dan versinya, lalu mengimpor setiap pustaka yang dibutuhkan secara terpisah. Setelah itu agent menjalankan skrip tes singkat yang membaca file dan menampilkan ringkasan sebelum pekerjaan penuh dijalankan.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Mengapa impor diuji satu per satu?

Cara ini menunjukkan dengan tepat pustaka mana yang hilang atau rusak, sehingga perbaikannya lebih cepat.

Apa yang dilakukan skrip tes minimal?

Skrip mencoba membaca spreadsheet dan menampilkan jumlah baris, yang memastikan dasar-dasarnya berfungsi.

Apakah ini hanya berlaku untuk file Excel?

Tidak. Langkah-langkahnya juga berlaku untuk file CSV dan data tabular lainnya.

Detail

Deskripsi asli dari pembuat

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

repo: HKUDS/AgentPilot

Popularitas

Bintang GitHub
7.8k
Peringkat
#12963
Lisensi
MIT
Diperbarui
1/11/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • …

Skill lain dari repositori ini

Skill serupa