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/rebound3
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?
4
u/jsonathan Apr 17 '18 edited Jan 09 '19
It already works for Node, but I probably won't find the time to make another package :(
1
12
2
4
4
4
1
u/TallDatabase Apr 18 '18
Brilliant work! By the way, is there something similar for C/C++?
2
u/jsonathan Apr 18 '18
No, not that I know of. I don't plan on adding support for lower level languages since searching "SEGFAULT" on Stack Overflow isn't going to help anyone.
3
Apr 17 '18
This is one of the greatest invention of all mankind history, for real. Holy shit, I love this.
2
2
3
u/pencan Apr 17 '18
I'm surprised no one has linked the, as always, relevant xkcd (check out the title text)
2
2
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/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
1
1
1
1
1
1
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
-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.
1
u/jsonathan Apr 17 '18 edited Jul 10 '18
Yeah, that's true, but there are also some more obscure error messages out there that even seasoned developers haven't encountered. Plus, using rebound is practically the same as running a file normally, but with the added ability to quickly browse answers that could potentially help solve an error. So I don't really see the downside.
And if you're copying someone's code from SO in the first place, it's on you to put in the effort to fully understand that person's solution to the problem.
1
0
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?
11
0
Apr 17 '18
[deleted]
37
u/jsonathan Apr 17 '18 edited Apr 12 '19
I could add that..
When you open an answer, there'd be an option to edit the code block and automatically insert it before the line the error occurred at (as a comment). That way you could return to your editor and work on integrating it into the rest of your code. It would take some playing around w/ subprocess but it's probably doable.
13
u/stupac62 Apr 17 '18
But insert the date of answer so user can identify how appropriate it is. Good work though!
170
u/iconfinder Apr 17 '18
And rerun the code using the rebound command. Repeat until no compile errors.
0
11
u/kaihatsusha Apr 18 '18
The top answer is often "this question has been locked because arbitrary moderation makes us happy".
5
u/strange-humor Apr 17 '18
Seems like a very strange and highly entertaining attack vector for someone...
MuuhuhuhuHAHA HA Haaaa.
2
u/orangehumanoid Apr 18 '18
Reminds me of "stack overflow considered harmful": https://saschafahl.de/papers/stackoverflow2017.pdf
3
u/mickyficky1 Apr 18 '18
Collaborate with stackoverflow-import, a lot of the work is already done there :)
1
0
0
Apr 17 '18
[deleted]
36
u/Gprime5 if "__main__" == __name__: Apr 17 '18
Someday even programming will be automated.
30
u/luxliquidus Apr 17 '18
I keep hearing this, and I suppose it is possible. But you still want a competent human (i.e. not management) to tell the computer what to do. And at its core, that's all programming is.
9
u/Scypio Pythoneer Apr 18 '18
From the point of view of an "old asm" programmer the current breed of high level languages is "automated" programming. Or even magic if you want to look at it this way. There always be a need for a programmer, the tools will differ.
16
u/_JGPM_ Apr 17 '18
And then one day bot programmers will post on bot forums while "its rendering" about other bot programmers who are terrible at searching, splicing, compiling, and committing.
The future will be forced to repeat the past
3
u/Preparingtocode Apr 17 '18
It's ok, someone will have to maintain the automation.
5
u/PC__LOAD__LETTER Apr 17 '18
Not if we develop general AI.
6
u/Preparingtocode Apr 17 '18
That just leaves the world for QA then...
5
u/cuulcars Apr 17 '18
Until the QA is automated. But who QAs the QA automation? More QA software. It’s like the space shuttle computers coming to consensus.
2
u/strange-humor Apr 17 '18
Just what we want, popularity rule. Just look at Trending on Youtube to see how well that works. ;)
2
0
0
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 ;)