I don't want to silence any errors. I want to make a cool package.
Ever do this:
readline.getbegidx()
AttributeError!!!!11!!
"Oh it's actually..."
readline.get_begidx()
I want to make a package that fuzzy matches attributes to callables whenever there's an attribute error. I DONT want to silence any errors or exceptions.
So that when you do:
readline.getbegidx()
It does:
#AttributeError: getbegidx() doesn't exist but get_begidx() does.
#You probably mistyped this attribute name, assuming you meant:
readline.get_begidx()
So what I want to do is to catch every single attribute error and search through the attributes and if the similarity is above something like 98% match, but if not raise the exception, without the user having to do:
try:
except:
try:
except:
try:
except:
...
everywhere.
So I want to:
- Detect if an AttributeError occurs
- Catch it, get the attribute that was used
- If there was a similar attribute, apply that to the original code / replace it
- Run the function