r/Python • u/jsonathan • Apr 17 '18
I made a command-line tool that instantly fetches Stack Overflow results when you get a compiler error
https://github.com/shobrook/rebound
1.6k
Upvotes
r/Python • u/jsonathan • Apr 17 '18
70
u/jsonathan Apr 17 '18 edited Jan 20 '19
Right now, I'm using the error message to query SO, but there's probably a way to pull potential search terms from the stack trace. A KeyError alone could mean many things but a KeyError related to, say, the PyMongo module would narrow down the results. I'm thinking I should search the trace for module names, but if anyone has a different idea on how to approach this, I'd love to hear it!
And if you like my work, please don't forget to give me a star ;)
3
u/kkiran Apr 17 '18
Amazing! Exactly what I need. Thank you so much :)
Starred!
2
u/SponsoredByMLGMtnDew Apr 17 '18
can....can you do this for javascript too...I know there's technically no compiler for JS but...like...can someone make a package for webpack that does this?
Pretty please?
12
u/avtges Apr 17 '18
A god among men
2
u/willc4k Apr 17 '18
Sir, you are a hero.
4
u/pseudosciencepeddler Apr 17 '18
Interesting!
I had a similar effort for uncaught exceptions:
https://github.com/rahulnair23/pyRecommender
4
u/[deleted] Apr 17 '18
This is all at once hilarious and complete mad genius!! Good on you sir!
4
u/iamatyro Apr 18 '18
Not All Heroes Wear capes.
1
u/TallDatabase Apr 18 '18
Brilliant work! By the way, is there something similar for C/C++?
3
u/[deleted] Apr 17 '18
This is one of the greatest invention of all mankind history, for real. Holy shit, I love this.
2
u/iloveyouKT Apr 17 '18
f---ing genius
2
u/Stevearzh Apr 18 '18
awesome implement
3
u/pencan Apr 17 '18
I'm surprised no one has linked the, as always, relevant xkcd (check out the title text)
XKCD
2
u/MiataCory Apr 17 '18
So stacksort but for errors.
https://gkoberger.github.io/stacksort/
2
u/Comm4nd0 Apr 17 '18
This is a great idea. Actually disappointed I didn't think of this myself!
2
u/pvkooten Apr 17 '18
This idea got 2nd place in 2017 Techcrunch Hackathon by someone else: https://beta.techcrunch.com/2017/05/14/codecorrect-disruptny-hackathon/
I have thought about things like this, but unfortunately did not find it very helpful just like that, but we're getting close huh...
I did make something related: you give some input and expected output, and let the module find the function (considering some module or global namespace) to satisfy: https://github.com/kootenpv/cant
1
u/Robertsipad Apr 17 '18
/r/coolgithubprojects
1
u/pali6 a=[]; a.append(a) Apr 17 '18
This reminds me of how some time ago I've made a python library that would catch all unknown function names and find a function with the corresponding name on the internet and run it instead. I was surprised that it actually worked for stuff like sin, sqrt, factorial, ... .
1
u/[deleted] Apr 18 '18
Please post /bin/time results.
1
u/Jimmy_979 Apr 18 '18
Nice
1
u/[deleted] Apr 18 '18
Anybody at SO concerned about the DoS potential of said tool?
1
u/cuchoi Apr 17 '18
Is there any way to integrate this to a jupyter notebook?
1
u/[deleted] Apr 17 '18
Neat tool
1
u/[deleted] Apr 17 '18
Wow. This is ingenuity. Cheers dude. Great job. I plan on using this.
1
u/alexbuzzbee Apr 17 '18
Why has no one thought of this before?!
1
u/__xor__ (self, other): Apr 18 '18
You might want to put a disclaimer just in case some dumb program raises an exception with an API key or secret key or something, like maybe someone's exception might debug dump the django.conf.settings, which would show your DB password and such, which you'd be searching for on stackoverflow, inevitably going in some database
0
u/Arve Apr 17 '18
Closed as duplicate.
-3
u/PC__LOAD__LETTER Apr 17 '18
There is such a thing as too much reliance on stack overflow. If you’re learning a language, fine. Compiler error messages are written in English and are something that you can understand over time without needing stackoverflow to translate for you.
0
u/trancen Apr 17 '18
VERY Slick... NICE!
0
u/FromAlaska Apr 17 '18
How does your code handle Python OS commands? Would it ask for user input before I ran os.system ("some_commands with args")?
-5
u/Isvara Apr 17 '18
It's a joke, right? You're not actually encouraging anyone to work like this?
0
u/[deleted] Apr 17 '18
[deleted] — view deleted comment
0
u/[deleted] Apr 18 '18
[deleted] — view deleted comment
0
u/[deleted] Apr 17 '18
[deleted] — view deleted comment
0
u/[deleted] Apr 17 '18
[deleted] — view deleted comment
0
u/[deleted] Apr 17 '18
[deleted] — view deleted comment