Skip to content

Codebug explains the buggy code in simple terms and offers ways to fix the code.

License

Notifications You must be signed in to change notification settings

gabrielchasukjin/codebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codebug

Codebug replaces scary error messages with digestible text-explanations of the error.

Demo

When pandas encounters an error, it spits out a massive red text.

  1. Hard to discern the error message
  2. Bold red text discourages coding beginners

codebug_error

Codebug solution

codebug_sol

Codebug takes in the error message and returns a simple explanation of it.

  1. Encourages student to understand the error
  2. Clears up python misconceptions
  3. Offers practical suggestions to fix buggy code

Codebug is powered by GPT-3.5 from OpenAI.

Table of Contents

Installation

Add this line to your command line:

pip install Codebugger

If encounter ModuleNotFoundError:

Run following code in python file:

import sys
print(sys.executable)

Copy the path (i.e. it may look like this):

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3

Install codebugger using the following path in the terminal:

/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install Codebugger

Usage

Add the following to your python file:

from codebugger import Codebug

Instance

Create new instance of Codebug() class:

debug = Codebug()

Error Message

Print Error Message:

debug.getMessage()

When no errors are encountered, Codebug returns: "No errors found!"

OpenAI API KEY

To recieve explantions of error, user must get API Key from OpenAI: https://platform.openai.com/account/api-keys

Set API-KEY

debug.setAPI('API-KEY')

Explnation of Error

Requires basic understanding of try/except.

Try and Except:

try:
  block of code
except Exception as e: 
  debug.setError() # Compiles the error
  print(debug.explnation()) #API Call to GPT-3.5 for explnation of error
  

About

Codebug explains the buggy code in simple terms and offers ways to fix the code.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages