GPTPythonFixer
This script leverages OpenAI's ChatGPT to provide assistance in fixing or suggesting solutions for errors in a Python file. It supports two modes of operation: processing the Python code directly or analyzing the output of a Python file via pipe. By interacting with ChatGPT, the script generates suggestions or explanations tailored to the provided.
Install / Use
/learn @z0m31en7/GPTPythonFixerREADME
python GPTPythonFixer.py <file_path> [-p | --pipe]
Arguments:
- file_path: The path to the Python file to be fixed or analyzed.
- -p, --pipe: Optional argument. If provided, the script will use the output of the Python file via pipe instead of directly processing the file.
<br><h2>🛠️ Functionality:</h2><br>
- Reads the specified Python file or captures the output of a Python file via pipe.<br>
- Interacts with ChatGPT to generate suggestions or explanations based on the provided Python code or output.<br>
- If operating on the file directly:<br>
- Prints the suggested code or error explanation.<br>
- Prompts the user to confirm replacing the code in the file.<br>
- Replaces the code in the file if the user confirms.<br>
- If using the output via pipe:<br>
- Prints the suggested output based on the ChatGPT response.<br>
<br><h2>🔮 Examples:</h2>
-
Process Python file directly:
python fix_python_file.py path/to/your/python/file.py -
Process Python file output via pipe:
python error.py | python fix_python_file.py -p
<br><h2>📜 Note:</h2>
- The script requires the OpenAI Python package (
openai) to be installed. - Replace 'YOUR_API_KEY' with your actual OpenAI API key in the script.
- Exercise caution when replacing code in a file and perform adequate testing.
- The script provides a basic example and may not handle all complex code or errors.
- The changes are suggested by ChatGPT and might contain errors.
<br><h2>🛡️ License:</h2><br> This project is licensed under the <a href="https://github.com/z0m31en7/GPTPythonFixer/blob/main/LICENSE">MIT-LICENSE</a><br><br>
Related Skills
claude-opus-4-5-migration
96.8kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
344.1kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
openhue
344.1kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
344.1kElevenLabs text-to-speech with mac-style say UX.
