Monday 31 March 2008

Python hacks: Traceback error solutions via Bug.gd

Wow.

My favorite programmer(s) has just released a cool little python tool to search for your traceback errors on their site. For those of you not familiar with Bug.gd it is a free error / problem troubleshooting site that encourages you to share fixes with other people (if you have them).

When you have a traceback error you can't figure out, rather than fire up FireFox (or whatever) to search Bug.gd, you can now use this tool and type "error_help()". It dumps out a list of all the solutions (if any) into the prompt. If there are no solutions the site gently prods you by email a couple of days later to see if you found a fix: an then to share it!

I have to say this is the kind of thing that will get me using Bug.gd - I liked the idea of the site up till now but never really used it. I generally found Google gave me quicker answers than Bug.gd - and then I clean forget to upload that content to the site (lazy 'ol me). However this ace tool will probably get me using it more often, because it means people will be searching for more errors on the site and so more content.

On top of that the idea just gets me excited - I love integration (especially Web2.0 style integration and sharing) and this is a fine example. What other language gets you user generated error solutions & content from the prompt / IDE!

Plus think of all the tools - theoretically you could put together an auto-fixer to try and fix common errors on the fly (just an idea).

I hope this tool carries on developing: I'd love the ability to send back my solution from the command prompt, inline editing of the error line, sending feedback on errors and so on. Imagine doing this:

# !python <test.py>
0/0

Then run it in IDLE:

>>> import test

Traceback (most recent call last):
File "<pyshell#14>", line 2, in <module>
import test
File "C:/Python25/Lib/site-packages\test.py", line 1, in <module>
0/0
ZeroDivisionError: integer division or modulo by zero

>>> error_help()
========== 1 of 8 ==========
Error: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero

Solution: I divided by zero as a test. Maybe you did the same thing?
The trick is not to divide by zero!
========== 2 of 8 ==========
Error: Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named shinynewmodule

Solution: (Example error and solutions)
I didn't have the shinynewmodule installed.
You can install it via fake_easy_install shinynewmodule

>>> used_solution(1) # gives feedback to the site
>>> edit_error_file(2) # quick edit the line number
Enter the new line: 0/1
>>> import test
0
>>> add_solution("Do not divide by zero - this solution added from IDLE itself!") # and if there were no answers? let me upload one!

Umm yeh, so it's a bit long winded but why not!

This certainly made me feel good:

This is a bit of a hint of some of our long-term plans with our technology. You should give it a whirl and let us know what you think.

Here's hoping for MORE good stuff from the guys.

PS: I really need to sort out my formatting / layout options on this blog.. hand colouring the code there was NOT fun and Blogger doesn't seem to have "code" style blocks :(

No comments: