मुख्य सामग्री पर जाएँ
Skillpedia
एनालिसिस और स्प्रेडशीट7.8k · #12963

python-spreadsheet-debug

यह क्या करती है

यह स्किल स्प्रेडशीट कामों के लिए Python में जाँचों का एक क्रमबद्ध सेट देती है। यह उन लोगों के लिए है जिनकी स्प्रेडशीट स्क्रिप्ट विफल होती है और जिन्हें पता लगाना है कि समस्या सेटअप में है या स्क्रिप्ट में।

कब इस्तेमाल करें

  • ✓जब स्प्रेडशीट स्क्रिप्ट विफल हो और शेल आउटपुट समझना मुश्किल हो।
  • ✓जब आपको शक हो कि Python या कोई लाइब्रेरी गायब है या गलत वर्ज़न की है।
  • ✓जब आप पूरे काम से पहले एक छोटे परीक्षण से पक्का करना चाहें कि फ़ाइल पढ़ी जा सकती है।

Skill का लिंक

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

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/python-spreadsheet-debug/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“मेरी स्प्रेडशीट स्क्रिप्ट बिना साफ़ कारण के विफल हो रही है। जाँचिए कि Python और pandas काम करते हैं, फिर फ़ाइल पढ़ने का परीक्षण कीजिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट जाँचता है कि कौन सा Python इस्तेमाल हो रहा है और उसका वर्ज़न क्या है, फिर हर ज़रूरी लाइब्रेरी को अलग से इम्पोर्ट करता है। इसके बाद वह एक छोटी परीक्षण स्क्रिप्ट चलाता है जो फ़ाइल पढ़कर सारांश छापती है, पूरा काम चलने से पहले।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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
अक्सर पूछे जाने वाले सवाल

लाइब्रेरी अलग-अलग इम्पोर्ट करके क्यों जाँचें?

इससे ठीक पता चलता है कि कौन सी लाइब्रेरी गायब या खराब है, इसलिए समाधान जल्दी मिलता है।

न्यूनतम परीक्षण स्क्रिप्ट क्या करती है?

वह स्प्रेडशीट पढ़ने की कोशिश करती है और पंक्तियों की गिनती छापती है, जिससे बुनियादी बातें काम करने की पुष्टि होती है।

क्या यह सिर्फ़ Excel फ़ाइलों पर लागू होता है?

नहीं, ये चरण CSV फ़ाइलों और दूसरे टेबल डेटा पर भी लागू होते हैं।

जानकारी

लेखक का मूल विवरण

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

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#12963
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills