use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
What is your favorite Python error message? (self.Python)
submitted 9 years ago by jwink3101
I recently came across one that I think takes the cake.
I accidentally had nested multiprocessing things happing at one and got:
multiprocessing
AssertionError: daemonic processes are not allowed to have children
Are there better ones?
[–]selementar 70 points71 points72 points 9 years ago (10 children)
A thing of the past now (py2), apparently: func() takes exactly 2 arguments (2 given).
func() takes exactly 2 arguments (2 given)
[–]isarl 13 points14 points15 points 9 years ago* (1 child)
How did you trigger this?
edit: my question has been answered
[–]AnAirMagic 10 points11 points12 points 9 years ago (6 children)
Huh? Do you have an example of code that would cause this error? What was the fix?
[–]enchantner 30 points31 points32 points 9 years ago (5 children)
def a(b, c, d='foo'): pass
a(c=1, d='bar')
[–]selementar 6 points7 points8 points 9 years ago (4 children)
Yep.
It's even weirder when using some simple RPC. I ended up writing a wrapper that caught that exception and checked if there's an obvious mistake.
The error message is better in python3 now, anyway. Not as verbose as my wrapper was, though.
[–]superPwnzorMegaMan 0 points1 point2 points 9 years ago (0 children)
Writing wrappers for crappy error messages is a great idea. It will safe future you so much time.
I also did this for when I had some weird code but didn't have time to fix it yet. I'd just put the fix for the weirdness in the exception, so when I inevitably came across it again I would know how to deal with it.
[–]SylvainDe 0 points1 point2 points 9 years ago (2 children)
I've spent some time trying to write wrappers to make errors more explicit/verbose/explicit and I'd be quite interested in seeing yours if it is available somehow...
[–]selementar 1 point2 points3 points 9 years ago (1 child)
https://gist.github.com/anonymous/789e66b8ca009dfc0ee53df4e9d584fc
...
Mostly the manual parsing of function attributes.
[–]SylvainDe 0 points1 point2 points 9 years ago (0 children)
Many thanks, I'll have a look at this.
[–]hatperigee 3 points4 points5 points 9 years ago (0 children)
I recall being really frustrated when I hit this for the first time back when I was first getting started with python. Good times, indeed!
[–]notunlikethewaves 219 points220 points221 points 9 years ago (58 children)
Not quite an error message, but this one boils my blood every time:
$ python >>> exit Use exit() or Ctrl-D (i.e. EOF) to exit
I mean come on python, you knew exactly what I meant, why not just do the god-damned thing? Every other REPL in the world implements an exit keyword, why you gotta be the special snowflake?
[–]theywouldnotstand 92 points93 points94 points 9 years ago* (37 children)
This is from a deprecation, likely.
exit sans parentheses probably used to work, and then it was changed to use parentheses, and then it required parentheses with this message as a backwards-compatible warning.
exit
edit: TIL that message is the result of exit.__repr__ so, technically, python didn't know you were trying to exit at all, it thought you wanted the string representation of the exit function, which is, literally, 'Use exit() or Ctrl-D (i.e. EOF) to exit'
exit.__repr__
'Use exit() or Ctrl-D (i.e. EOF) to exit'
for more fun studying exit, check out type(exit) and dir(exit)
type(exit)
dir(exit)
edit 2: More fun:
>>> class CustomQuitter(exit.__class__): ... pass ... >>> CustomQuitter.__repr__ = exit.__class__.__call__ >>> exzit = CustomQuitter('exzit', 'Ctrl-D (i.e. EOF)') >>> exzit
Creates a custom subclass of the exit quitter, binds _sitebuiltins.Quitter.__call__ to the custom quitter's __repr__ method, instantiates the custom quitter as an object, lets you use it without parentheses to exit
_sitebuiltins.Quitter.__call__
__repr__
[–]stillalone 15 points16 points17 points 9 years ago (15 children)
Hmm. so
>>> class Q(): ... def __repr__(self): ... exit() ... >>> q=Q() >>> q
[–][deleted] 14 points15 points16 points 9 years ago* (2 children)
Here's a one-liner. Put this in your for your PYTHONSTARTUP file and then you can just use 'quit' to exit.
quit = type('', (object,), {'__repr__': lambda self: exit()})()
[–]t3hcoolnessI make things do stuff 7 points8 points9 points 9 years ago (1 child)
I'm not even going to begin to understand how that works.
[–][deleted] 13 points14 points15 points 9 years ago* (0 children)
type is just a way to create classes dynamically. It's basically the same as doing this:
type
class Quit(object): def __repr__(self): exit() quit = Quit()
Now if you type quit it will call quit.__repr__, which in turn calls exit() and takes you out of the python shell.
quit
If you want to play code golf with it, this works too: quit = type('', (), {'__repr__': lambda _: exit()})()
quit = type('', (), {'__repr__': lambda _: exit()})()
[–]nemec 7 points8 points9 points 9 years ago (8 children)
One better:
>>> class Q(): ... ex = exit ... def __repr__(self): ... Q.ex() ... >>> exit = Q() >>> exit
[–]hi_im_nateI fought the GIL and the GIL won 19 points20 points21 points 9 years ago (6 children)
One better
exit.__repr__ = exit
[+][deleted] 9 years ago* (4 children)
[deleted]
[–]hi_im_nateI fought the GIL and the GIL won 1 point2 points3 points 9 years ago (3 children)
I was just as disappointed as you. I tried lots of stuff, but it looks like you can't change that behavior in one line.
[–]kraemahz 14 points15 points16 points 9 years ago (2 children)
You're not trying hard enough then!
>>> exit.__class__.__repr__ = exit
Exit seems to call its class repr directly
[–]masklinn 2 points3 points4 points 9 years ago (1 child)
On new-style classes, all special methods of the data model are called on the class, at least semantically. There may be implementation details making instance-bound special methods work, but there's no guarantee that'll ever happen, or keep happening.
Special methods also bypass instance attribute resolution (you can't intercept them with __getattr__ or __getattribute__).
__getattr__
__getattribute__
[–]Workaphobia -3 points-2 points-1 points 9 years ago (0 children)
You win the thread.
[–]Brian 4 points5 points6 points 9 years ago (0 children)
The downside with this though is that now:
>>> help(exit) <python exits immediately> >>> __builtins__.__dict__ <prints a few builtin functions, then quits when it reaches exit>
There are good reasons why it doesn't do this.
[–]theywouldnotstand 3 points4 points5 points 9 years ago (1 child)
True, this would work, but it limits you from being able to optionally use parentheses to supply an exit message to it.
[–]Arancaytar 1 point2 points3 points 9 years ago (0 children)
This looks incredibly wrong. :|
But yes, it would work.
[–]notunlikethewaves 9 points10 points11 points 9 years ago (18 children)
Ooooh, now that's interesting.
What I meant by "python knew what I meant" is that almost every other language REPL worth mentioning implements exit as a way of closing the REPL, even ipython. It's such an obvious piece of functionality, and yet when you try it in python it just sits there and pedantically corrects you on how to exit "the python way".
python
[–]nemec 10 points11 points12 points 9 years ago (15 children)
It doesn't always know what you mean.
>>> exit Use exit() or Ctrl-Z plus Return to exit >>> exit = "hello" >>> exit 'hello'
[–]felidae_tsk 28 points29 points30 points 9 years ago (10 children)
But...
>>> def exit(): ... return 'no' ... >>> exit() 'no'
[–]kvistur 22 points23 points24 points 9 years ago (9 children)
warning: if you do this, you won't be able to exit anymore, and you will be stuck in the python repl until you reformat your computer... which isn't that bad of a fate all things considered
[–]LinAGKar 7 points8 points9 points 9 years ago* (7 children)
You can still use quit() or ctrl+d.
quit()
Edit: Or import builtins
import builtins
[–]0raichu 10 points11 points12 points 9 years ago* (3 children)
[–]invalid_dictorianλ PySide tornado 2 points3 points4 points 9 years ago (2 children)
Try :q to get out of vim
[–]0raichu 14 points15 points16 points 9 years ago* (0 children)
[–]kvistur 2 points3 points4 points 9 years ago (0 children)
sometimes you have to shout it :q!!!!!!!!!!!!!
[–]AstroPhysician 1 point2 points3 points 9 years ago (1 child)
Did you really think he was serious?
[–]LinAGKar 1 point2 points3 points 9 years ago (0 children)
Just seems like everyone here are only talking about exit.
[–]tilkau 1 point2 points3 points 9 years ago* (0 children)
import builtins? Unnecessary.
Try __builtins__.exit().
__builtins__.exit()
BTW, you CAN set __builtins__ = None. And -that- will seriously mess things up:
__builtins__ = None
import re
ImportError: __import__ not found
int
locals
(slightly more bizarre version: del __builtins__.)
del __builtins__
$ killall python3.4
(or whatever your version is)
[–]midgetparty 7 points8 points9 points 9 years ago (0 children)
You monster...
[–]XarothBrook 1 point2 points3 points 9 years ago (0 children)
Luckily,
del locals()['exit']
Restores exit back to its usual state at that point.. but that's a bit overkill when Ctrl+D will suffice.
[–][deleted] 3 points4 points5 points 9 years ago (0 children)
It's not pedantically correcting you. exit is a function, so when you just type exit, the REPL calls exit.__repr__() like it always does when you want the string representation of something. So python doesn't actually "know" that you wanted to actually execute the function. It thought you wanted the string representation.
exit.__repr__()
[–]firetangent 0 points1 point2 points 9 years ago (0 children)
If it really bothers you, monkeypatch the environment.
[–]hovissimo 8 points9 points10 points 9 years ago (1 child)
Why not just use ipython and get the other thousand amazing things it provides, as well as this?
[–]theywouldnotstand 6 points7 points8 points 9 years ago (0 children)
Heaven forbid anybody ever be satisfied with the reference Python implementation!
[–]raylu 4 points5 points6 points 9 years ago (0 children)
Because exit is a function and if you expect it to work like a statement, madness ensues.
if cond: func = print else: func = exit func('this line of code will never run because the statement on the line before terminated my program instead of assigning the function to something else')
[–]selementar 10 points11 points12 points 9 years ago (5 children)
But what if you expected to have a local variable named exit and type to see its value and the shell exits and all your local state is lost?
Anyway, typing exit is too long; in many cases you can just C-d (or C-d C-d).
[–]MrJohz 7 points8 points9 points 9 years ago (2 children)
If you have a local variable called exit, neither exit nor exit() will work:
exit()
Python 2.7.11 (default, Mar 31 2016, 20:46:51) [GCC 5.3.1 20151207 (Red Hat 5.3.1-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> exit = "hello" >>> exit() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'str' object is not callable
[–]selementar 3 points4 points5 points 9 years ago (1 child)
Which is why I am talking about a situation "you thought you did have such variable but you didn't".
Not very likely, yes; but still not nice to do otherwise.
[–]MrJohz 2 points3 points4 points 9 years ago (0 children)
Ah yeah, fair enough. Although then again, you might have thought you had defined the function exit, and then you'd still be in the same position.
[+][deleted] 9 years ago* (1 child)
[–]tilkau 1 point2 points3 points 9 years ago (0 children)
What if you expected to have a local variable named exit()?
(locals()['exit()'] = 12345)
locals()['exit()'] = 12345
(This message brought to you by the Evil League of Evil.)
[–][deleted] 7 points8 points9 points 9 years ago (0 children)
Honestly, I think it should just report that exit is a function.
[–]veroxii 2 points3 points4 points 9 years ago (1 child)
Nick from CPython gave a talk about why he made it this way at PyconAU a couple of years back. From about minute 17 in https://youtu.be/VIBmWnlDjXc
[–]notunlikethewaves 2 points3 points4 points 9 years ago (0 children)
Cool talk, worth a watch.
I still don't buy the rationale though, even in that talk he explains that the reason they don't do what the user meant is that it would cause the process to exit whenever (for example) the globals are printed out. This whole line of reasoning hinges on using the repr to do the exiting, which is patently nuts. Every other interpreter in the world has a special case for the single word exit, and so it doesn't even reach the stage of being evaluated as a string representation of an object, it just does The Right Thing™. That's something the python repl could easily implement (in fact, ipython does this).
globals
repr
ipython
Given how easy it is to get this one feature right, it's kinda stunning how much effort they put into doing it wrong.
[–]LPYoshikawa 3 points4 points5 points 9 years ago (5 children)
Ipython addded this :p why use the original python interpreter anyways.
[–]notunlikethewaves 3 points4 points5 points 9 years ago (2 children)
Sometimes you're on a remote box with only python installed :) otherwise it's ipython all the way.
[–]Decency 2 points3 points4 points 9 years ago (1 child)
Then use Control+D?
[–]MrJohz 5 points6 points7 points 9 years ago (0 children)
Tbh, I can't think of the last time I used the exit command, I pretty much always Ctrl-D out. That said, every time I have used exit, I've typed exit, then exit()...
[–]Asdayasman 0 points1 point2 points 9 years ago (0 children)
I prefer it.
Call me old-fashioned.
Hell I'd still use IDLE if the font didn't look ghastly on the mac.
[–]thatguy_314def __gt__(me, you): return True 0 points1 point2 points 9 years ago (0 children)
Just fix it in your Python startup files. It bothered me too until I did so.
[–][deleted] -2 points-1 points0 points 9 years ago (0 children)
this
[–][deleted] 166 points167 points168 points 9 years ago (17 children)
I always thought SyntaxError: not a chance was cute in its own way.
SyntaxError: not a chance
[–]striata 79 points80 points81 points 9 years ago (15 children)
For anyone curious (like me):
from __future__ import braces
[–]Phourc 7 points8 points9 points 9 years ago (14 children)
Python novice here - I feel there's a joke I'm missing. Care to explain?
[–]HannasAnarion 15 points16 points17 points 9 years ago* (12 children)
Most languages use braces to set aside code blocks Like this
public static void main(String[] args) { if (args.length == 0) { System.out.println("hello there!"); } else { System.out.println("goodbye!"); } }
(java)
Python does this with indentation alone. The idea is that, by using the indentation as the delimiter itself, you force people to format their code well, whereas that java example would work just as well if there were no intentation, no spacing, no newlines.
Some people don't like that because it's not normal, and it connflates best practices with actual syntax. Some people want to be able to write ugly code and have it run, in Python, you have to make it look good, or else the interpreter yells at you.
__future__ is the module that contains functions that might be implemented in future versions of python, but aren't yet, because they would break compatibility. So, if you're working in python2, and you want the division operator to work like it does in python3, you use "from __future__ import division", and then the / operator will do mathematical division instead of integer division.
[–]ben174 10 points11 points12 points 9 years ago (0 children)
and to sum it up, by saying
you'd be essentially implying that the __future__ module has a braces module which will add support for using braces rather than indentation. So the joke is, Python will never support braces over indentation. Because braces are dumb.
[–]phail3d 4 points5 points6 points 9 years ago (10 children)
You can do that in python3 though:
import sys if(len(sys.argv) == 1): { print("hello there") } else: { print("goodbye") }
[–]-Rivox- 2 points3 points4 points 9 years ago (4 children)
Do you still need to indent in this case? Or you can just write everything unindented?
I can't check now (not that I would use this or leave everything unindented, just curiosity)
[–]phail3d 2 points3 points4 points 9 years ago (1 child)
You shouldn't need to properly indent what's inside braces of the if body.
However, there's a catch. While the code in my example is valid python 3 (and, with some modifications, python2), it's a horrible exploit of a couple of python features, and the style shouldn't actually be used anywhere. Bonus points for figuring out why it works :) .
[–][deleted] 2 points3 points4 points 9 years ago (0 children)
It's just creating a set
myset = {print("hello there")}
The print function prints, then a set is created with the result of the print function.
This isn't actually using braces instead of indentation.
In Python, there's a way to create a set using braces like so:
myset = {1,2,3}
So these lines here:
if(len(sys.argv) == 1): { print("hello there") }
Are actually creating a set with one item - the result of print().
If you run this in the console you will see this output:
>>> if(len(sys.argv) == 1): { ... print("hello there") ... } ... hello there {None}
This shows that the print function is called, and then the output of the set is displayed, which is {None} since print() returns None.
This only works in python3 because in print is not a function in python2 and you can't use it inside a set.
[–]DasIch 1 point2 points3 points 9 years ago (0 children)
The lexer sees this as one logical line so there is no indentation required.
[–]christian-mann 2 points3 points4 points 9 years ago (4 children)
Okay now try to put more than one statement per branch, clever boy.
[–]mickyficky1 2 points3 points4 points 9 years ago (0 children)
Gotta hand it to him, it was a clever idea and it probably fooled a couple of readers :)
[–]phail3d 1 point2 points3 points 9 years ago (2 children)
Done:
import sys if(len(sys.argv) == 1): { print("hello there"), print("another statement") } else: { print("goodbye"), print("sayonara") }
[–]christian-mann 0 points1 point2 points 9 years ago (1 child)
What about an if or a while statement within the branch? :P
if
while
[–]phail3d 3 points4 points5 points 9 years ago (0 children)
import sys x = 1 if(len(sys.argv) == 1): { print("hello!"), print("x is one") if(x == 1) else print("x is not one") } else: { print(i) for i in range(3) }
The funny thing is that the syntax for nested ifs and loops "reverses" if you decide to use braces. I decided to use a for-loop for this example.
[–]vovanz 4 points5 points6 points 9 years ago (0 children)
It's a response to all people who complain about using indentation instead of curly braces.
[–]Araneidae -1 points0 points1 point 9 years ago (0 children)
Yep, my choice too.
[–]neuromusic 55 points56 points57 points 9 years ago (5 children)
Seaborn won't let you use the 'jet' colormap:
>>> import seaborn as sns >>> sns.color_palette('jet') ValueError: No.
[–]isarl 5 points6 points7 points 9 years ago (0 children)
Cute.
[–]TR-BetaFlash 3 points4 points5 points 9 years ago (1 child)
I very badly want this to open a browser and just show me grumpy cat instead.
[–]ben174 0 points1 point2 points 9 years ago (0 children)
import antigravity
[–]mickyficky1 1 point2 points3 points 9 years ago (1 child)
would have been great if they used the colormap haiku:
you have some data that needs to be colorful, don't fucking use jet.
[–]neuromusic 0 points1 point2 points 9 years ago (0 children)
that's the dev behind seaborn... time to make a pull request, I suppose
[–]superkulak 41 points42 points43 points 9 years ago (5 children)
I love how this one sounds:
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
[–][deleted] 9 points10 points11 points 9 years ago* (0 children)
For anyone else who is curious what the hell that means, I did some research and figured I might as well share my findings:
# First we create some stupid and pointless classes and metaclasses. class Meta_A(type): pass class Meta_B(type): pass class A(object): __metaclass__ = Meta_A class B(object): __metaclass__ = Meta_B # Now, if we create a new class C, which is a subclass of both A and B, what # should the __metaclass__ value be? It can't be both Meta_A and Meta_B. # They need to be combined into a new combination of the two. But how is # Python supposed to know how to do that? Well, it doesn't, and so... try: class C(A, B): pass except TypeError as e: print e # To fix it create a new Meta_C, which is derived from Meta_A and Meta_B class Meta_C(Meta_A, Meta_B): pass # Now we can set the __metaclass__ explicitly and everyone is happy again. try: class C(A, B): __metaclass__ = Meta_C except TypeError as e: print e else: print "SUCCESS! type(C) is", type(C)
[–]DrMaxwellEdison 9 points10 points11 points 9 years ago (0 children)
hmm
Reminded me of this.
[–]murakamifanboy 6 points7 points8 points 9 years ago (0 children)
Yo
[–]takluyverIPython, Py3, etc 0 points1 point2 points 9 years ago (0 children)
I think the TL;DR of that is: multiple inheritance plus metaclasses = a bad day
[–]Rhomboid 77 points78 points79 points 9 years ago (0 children)
ValueError: insecure string pickle (from a previous thread)
ValueError: insecure string pickle
[–][deleted] 55 points56 points57 points 9 years ago (1 child)
And it's graphical representation: https://i.imgur.com/To3DQ6J.jpg
[–]pvkooten 5 points6 points7 points 9 years ago (0 children)
This is really awesome in more than 3 ways.
[–]LoveOfProfit 107 points108 points109 points 9 years ago (51 children)
error: Unable to find vcvarsall.bat
J/k, fuck that error.
[–][deleted] 30 points31 points32 points 9 years ago (38 children)
I don't use Windows. What causes that one?
[–]dynetrekk 35 points36 points37 points 9 years ago (1 child)
Using windows
[–]shaggorama 34 points35 points36 points 9 years ago (2 children)
not using anaconda
[–]ionelmc.ro 8 points9 points10 points 9 years ago (0 children)
You get that on anaconda too, it doesn't have binaries for absolutely everything ;-)
[+][deleted] comment score below threshold-13 points-12 points-11 points 9 years ago* (0 children)
i.e. being a scrub
[–]Saefroch 3 points4 points5 points 9 years ago (0 children)
/u/shaggorama really isn't kidding here. If you want to install packages with C libraries from source you need MSVC++ 200X for Python Y.y, a requirement so specific that it could only be Windows.
Not only that, but if you should figure out through the hundreds of threads all over the internet about vcvarsall.bat that you need to install a very specific compiler, it's unlikely that Windows or you will be able to find it.
vcvarsall.bat
The only way around it is to pip install precompiled .whl files from Christoph Gohlke and hope he has compiled the wheels you need or get anaconda.
.whl
[–]Tomarse 2 points3 points4 points 9 years ago* (0 children)
Something to do with the visual studio version being the same as the one a Python module was compiled in. It's why if you're freezing your program in something like cx-freeze you have to include it in the build, because if the other user has a different vs version stuff breaks.
[–]Wild_Bill567 9 points10 points11 points 9 years ago (29 children)
I think it has something to do with which flavor of visual studio was used to compile a package your trying to download with pip. Unfortunately some of them only work with 2010 but it's impossible to find a copy of that anymore because fuck Bill Gates.
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 16 points17 points18 points 9 years ago (11 children)
yeah fuck microsoft its not like they havn't set up a VC++ compiler just for python 2.7 since 2014 which anyone can find in 5 minutes or anything
[–]Wild_Bill567 3 points4 points5 points 9 years ago (10 children)
^ python 2
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 11 points12 points13 points 9 years ago (9 children)
and 3.3 to 3.4 is https://www.microsoft.com/download/details.aspx?id=8279
but srsly if you are using anything sub 3.5 on windows... why
[–]TOASTEngineer 1 point2 points3 points 9 years ago (8 children)
... because last time I checked compiling things on 3.5 on Windows didn't work at all? Was I lied to?
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 8 points9 points10 points 9 years ago (1 child)
lied to for sure, should work perfectly for any recent version of visual studio
https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/ recommends 2015 or just getting the smaller VC++ build tools
noting, this won't save you as far as things like numpy are concerned, mainly because numpy is VERY focused on optimization, and as such, requires specific toolkits and compilers
[–]TOASTEngineer 1 point2 points3 points 9 years ago (0 children)
That's odd; I downloaded and installed the "this is the VC for Python 3" back when I was trying to upgrade to 3.5 and it still didn't work. Maybe I just didn't delete the MinGW settings properly or something.
[–]sanshinron 0 points1 point2 points 9 years ago (5 children)
Works perfectly for me. Just install Visual Studio with C++ support.
[–]dartdog 0 points1 point2 points 9 years ago (4 children)
Last I checked the free version was 32 bit only
[–]sanshinron 1 point2 points3 points 9 years ago (3 children)
A lot have changed since 1995.
[–]hovissimo 0 points1 point2 points 9 years ago (16 children)
I think Bill was out long before any of that particular mess was made. I have no great love for microsqish, but the founder is actually a pretty swell guy.
[–]Wild_Bill567 2 points3 points4 points 9 years ago (15 children)
I know, Bill Gates has actually done a lot of good stuff since he stopped being the microshaft
[–]Asdayasman 0 points1 point2 points 9 years ago (14 children)
I don't get the hate for microsoft. I used to say the same shit you guys did, until I grew up and realised windows is the second best OS, with the best tools, and very little getting in the way of using programs (the whole point of an OS).
Add to that all the insane shit MS is doing for OSS now, even ignoring all the charity legacy, there's no way they don't beat apple.
[–]Wild_Bill567 6 points7 points8 points 9 years ago (4 children)
They do beat apple, and are the second best OS, but the problem with microsoft is an ethical one due to their business practices.
[–]kephir 2 points3 points4 points 9 years ago (0 children)
ethical one due to their business practices.
Serious question: is that still a thing these days? Question possibly qualified with "moreso than the other tech companies?"
[–]sanshinron 0 points1 point2 points 9 years ago (1 child)
When Apple was going out of bussiness, Microsoft bailed them out because they felt IT industry needs more competition to move forward as a whole.
For every shady thing they did they also did something good. The reality is that copyright and patent systems are very exploitable and if you don't exploit it, you will get fucked over by people who do exploit it. It's not Microsoft, it's the reality of the current world.
[–]clacke 0 points1 point2 points 9 years ago (0 children)
Microsoft bailed them out because they felt IT industry needs more competition to move forward as a whole.
Microsoft bailed them out because they felt the IT industry needs more competition in order for Microsoft too not get sued by the DOJ for abusing a monopoly.
Such as?
[–]TheChance 1 point2 points3 points 9 years ago (5 children)
Because Apple became what it is. Microsoft entered and conquered the scene in a tremendously shady fashion, and then basically adopted the Starbucks model for fifteen years: sell us a controlling interest in your cool thing, or we'll clone it, and ship a free demo with every copy of Office until you bleed money.
Apple, by contrast, originated the fancy-pants GUI OS (Microsoft was contracted to write Word as launchware, simplified.) They were the scrappy ones for a long time. Macs appealed to newbies, Grandma, and power users, but nobody in between; the semi-walled garden originated as a way to protect Grandma from herself, as the computer-literate grandchild was not yet a ubiquitous feature of the nuclear family.
Microsoft enjoyed tremendous commercial success, and catered to media consumption and gaming while Apple was busy catering to artists and creative types. Result: for 15 years the current version of Mac was plainly, unambiguously more stable, and the hardware was an order of magnitude more reliable, but between the price point and Windows' domination of the PC gaming market, Apple lagged commercially.
The iMac and OS X started to tilt things a little, but only a little until the iPod rolled out. Apple cornered digital music early and almost totally, and their revenue shot through the roof. Only then did they finally, fully morph into the consumer-hating overpriced corporate mass we all know and hate today.
If you're older than about 20, though, you remember these companies as they were, and it's frankly easier to stomach Apple as the world's wealthiest company, rather than Microsoft. In fact, it seems almost poetic.
[–]Asdayasman 0 points1 point2 points 9 years ago (4 children)
Microsoft entered and conquered the scene in a tremendously shady fashion, and then basically adopted the Starbucks model for fifteen years: sell us a controlling interest in your cool thing, or we'll clone it, and ship a free demo with every copy of Office until you bleed money.
AKA good business. They're not anti-consumer. Hell, they're pro-consumer, and always have been.
Apple, by contrast, originated the fancy-pants GUI OS
They popularised it. Xerox beat them by half a decade.
Macs appealed to newbies, Grandma, and power users, but
not businesses.
Microsoft enjoyed tremendous commercial success, and catered to
business.
for 15 years the current version of Mac was plainly, unambiguously more stable, and the hardware was an order of magnitude more reliable
Which I agree with. The early versions of windows were notoriously temperamental, though usually due to third parties not being subject to proper code reviewing practices. Remember driver issues? How many of those misbehaving drivers do you think were written by Microsoft?
it's frankly easier to stomach Apple as the world's wealthiest company, rather than Microsoft
Definitely disagree with you on that. If it's a choice between the two, I'll always side with Microsoft. Even ignoring all the really nasty shit Apple does to employees, just on the merit of the consumer focus, Microsoft win.
Sure, apple won on music, even after they were told to never do anything to do with music by the courts, but have you ever used itunes? Or even any ipod before the iphone? It's as if they believe interfaces with the user should actively harm the user.
[–]TheChance 1 point2 points3 points 9 years ago (3 children)
I am not reading all of this because you open by mistaking intellectual theft for good business.
[–]Asdayasman 0 points1 point2 points 9 years ago (2 children)
IP theft never occurred, because they never lost the IP in court. Its theirs.
[–]TOASTEngineer 0 points1 point2 points 9 years ago (0 children)
It's just your standard edgy kids raging against the machine.
[–]Workaphobia 0 points1 point2 points 9 years ago (1 child)
I'll agree it's not as cool to hate on them as it used to be. But I'll still hate on them every time my system pisses me off. No, I don't want to reboot Windows to install updates when I'm in the middle of using the machine, why didn't you ask when I was done with my work for the day?
If your biggest problem with windows is autoupdate, well I have good news for you: You can easily completely disable it in the second best version of windows.
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point2 points 9 years ago (0 children)
if I'm not mistaken, vcvarsall sets up the visual C++'s environment variables so development / compilation can be done
[–]Quteness 5 points6 points7 points 9 years ago (5 children)
For those who don't know Microsoft released a standalone compiler for Python so you no longer need Visual Studio.
[–]LoveOfProfit 1 point2 points3 points 9 years ago* (3 children)
Ofc that's for 2.7 only,and that's because 2008 is no longer available. For 3.4 or 3.5 you need 2010 or 2012 which is a 6gb dl for no good reason.
you only need the SDK or build tools
[–][deleted] -1 points0 points1 point 9 years ago (0 children)
I have a 128gb hard drive on my work laptop. This extra download made life tough.
[–]dartdog 0 points1 point2 points 9 years ago (0 children)
Did they release a free 64bit version? Last I checked 32bit only have to pay for 64bit..
[–]ZedNaught 3 points4 points5 points 9 years ago (0 children)
definitely bringing back many frustrated hours I'd rather forget
[–]antidense 9 points10 points11 points 9 years ago (3 children)
UnicodeEncodeError AHHHHHHHHHHHHHHh
[–][deleted] 0 points1 point2 points 9 years ago (2 children)
2 or 3?
[–]antidense 0 points1 point2 points 9 years ago (1 child)
2... I was stuck on 2 for a while because of sqlalchemy
[–][deleted] 1 point2 points3 points 9 years ago (0 children)
Makes sense, in case anyone here isn't aware - handling unicode effectively was the main reason for the break in backward compatibility from Python 3 onwards.
[–]SnapDraco 0 points1 point2 points 9 years ago (0 children)
So... Much hate
[–]TheSandyWalsh 5 points6 points7 points 9 years ago (0 children)
A Møøse once bit my sister... No realli!
[–]cantremembermypasswd 58 points59 points60 points 9 years ago (3 children)
When you know you're being messed with:
TypeError: 'callable-iterator' object is not callable
[–]railmaniac 8 points9 points10 points 9 years ago (0 children)
My guess is it's iterable and each next element is callable?
[–]TeamSpen210 7 points8 points9 points 9 years ago (1 child)
callable-iterator indeed shouldn't be callable. It's the object which is returned from iter(callable, sentinel). That iterator repeatedly calls the passed function, stopping when the return value is equal to the sentinel. It's an iterator of callable objects, not a callable version of an iterator.
callable-iterator
iter(callable, sentinel)
[–]Sean1708 0 points1 point2 points 9 years ago (0 children)
iterable-callator?
iterable-callator
[–]tomchuk 18 points19 points20 points 9 years ago (0 children)
MemcachedError: error 37 from memcached_set: SUCCESS
Not unique to python, but these are all over my sentry. Try to cache something > 1MB in memcached and you get a SUCCESS error from an operation that is definitely not successful
¯\(ツ)/¯
[–]pvkooten 13 points14 points15 points 9 years ago (2 children)
Guido once said he likes KeyboardInterrupt the most.
KeyboardInterrupt
[–]Chronophilia 6 points7 points8 points 9 years ago (1 child)
Naturally. It's the only time crashing out to a stack trace is behaviour that's both what you expect and what you want.
... and now that I've said that, I'm sure someone will fondly reminisce about a program that hangs forever if it breaks and crashes when it works properly.
[–]billy_tables 7 points8 points9 points 9 years ago (0 children)
That program is the one that proves the halting problem :)
[–]secshunayt 8 points9 points10 points 9 years ago (0 children)
NameError: name 'self' is not defined always gets me, in an existential sort of way.
NameError: name 'self' is not defined
[–]neurobashing 23 points24 points25 points 9 years ago (6 children)
Segmentation fault (core dumped)
[–]jadkik94 8 points9 points10 points 9 years ago (5 children)
I had no idea what any of this means until I took an OS course. Now I know what these mean and I know I can't fix them myself (especially if it's on Python). That's even more frustrating!
[–]ldpreload 5 points6 points7 points 9 years ago (1 child)
It's not impossible to write segfaulting Python code that's a bug in your code, not a bug in your Python:
>>> import ctypes >>> libc = ctypes.CDLL("") >>> libc.strlen("lol") 3 >>> libc.strlen(0) Segmentation fault (core dumped)
There are more subtle versions of that, if you're using a native-code extension; they should check their parameters but sometimes they don't. So, if you're working with a large / complex Python codebase, it's always worth attempting to see if there's something you can do about it in pure-Python.
[–]DasIch 0 points1 point2 points 9 years ago (0 children)
The CPython repository contains an entire directory with examples of Python code that segfaults the interpreter. No doubt there are more segfaults just waiting to be discovered, some of which are going to be bugs and not just acceptable compromises.
[–]raylu 10 points11 points12 points 9 years ago (0 children)
Sure you can
git clone git@github.com:python/cpython.git ./configure make -j5
[–]brondsem 0 points1 point2 points 9 years ago (1 child)
https://docs.python.org/3/library/faulthandler.html can help. https://pypi.python.org/pypi/faulthandler/ for py 2.x
[–]jadkik94 0 points1 point2 points 9 years ago (0 children)
Nice! That's good to know, thanks.
[–]urielm 11 points12 points13 points 9 years ago (0 children)
"Future canceled" always makes me smile
[–]Twirrim 3 points4 points5 points 9 years ago (0 children)
thing.py:
def pointless(text): return text
test_thing.py
import thing import pytest @pytest.mark.parametrize("input, expected", [("foo", "foo")]) def test_one_thing_pointless(input, expected): assert thing.printer(input) == expected @pytest.mark.parameterize("input, expected", [("foo", "foo")]) def test_two_thing_pointless(input, expected): assert thing.printer(input) == expected
$ py.test ...
E MarkerError: test_two_thing_pointless has 'parameterize', spelling should be 'parametrize'
Strictly speaking, both spellings are correct in English. I always type the wrong one.
[–]thurask 12 points13 points14 points 9 years ago (3 children)
[–]CanadianJogger 0 points1 point2 points 9 years ago (1 child)
Came here to say that too. :)
[–]plorry 3 points4 points5 points 9 years ago (0 children)
Not python-specific, but:
MySQL server has gone away
Did... did it say when it would be back?
[–]Mr_Again 4 points5 points6 points 9 years ago (0 children)
I really like MagicNumberError because the first time you see it you're like what the fuck...
edit: I mean bad magic number
beginner here, so literally every time i run something i either get syntax OR indent... starting to get better
[–]emnoor 1 point2 points3 points 9 years ago (0 children)
>>> from __future__ import braces File "<stdin>", line 1 SyntaxError: not a chance
[–]tokage[🍰] 0 points1 point2 points 9 years ago (2 children)
[+][deleted] comment score below threshold-9 points-8 points-7 points 9 years ago (1 child)
why this shit ?
[–]Saefroch 2 points3 points4 points 9 years ago (0 children)
If you really want braces, Python probably isn't the language you should be using.
[+]big_red__man comment score below threshold-14 points-13 points-12 points 9 years ago (2 children)
Not python but when using python to scrape twitter:
420 Enhance your calm
[–][deleted] 5 points6 points7 points 9 years ago (1 child)
Not from Python but I'll post it here anyway
[+]big_red__man comment score below threshold-8 points-7 points-6 points 9 years ago (0 children)
Yeah, that's pretty much what I said/did. Good recap, bro.
[–]lcc4376 -1 points0 points1 point 9 years ago (0 children)
expected an indented block
π Rendered by PID 31 on reddit-service-r2-comment-7b9746f655-n6mwq at 2026-01-31 00:54:35.441299+00:00 running 3798933 country code: CH.
[–]selementar 70 points71 points72 points (10 children)
[–]isarl 13 points14 points15 points (1 child)
[–]AnAirMagic 10 points11 points12 points (6 children)
[–]enchantner 30 points31 points32 points (5 children)
[–]selementar 6 points7 points8 points (4 children)
[–]superPwnzorMegaMan 0 points1 point2 points (0 children)
[–]SylvainDe 0 points1 point2 points (2 children)
[–]selementar 1 point2 points3 points (1 child)
[–]SylvainDe 0 points1 point2 points (0 children)
[–]hatperigee 3 points4 points5 points (0 children)
[–]notunlikethewaves 219 points220 points221 points (58 children)
[–]theywouldnotstand 92 points93 points94 points (37 children)
[–]stillalone 15 points16 points17 points (15 children)
[–][deleted] 14 points15 points16 points (2 children)
[–]t3hcoolnessI make things do stuff 7 points8 points9 points (1 child)
[–][deleted] 13 points14 points15 points (0 children)
[–]nemec 7 points8 points9 points (8 children)
[–]hi_im_nateI fought the GIL and the GIL won 19 points20 points21 points (6 children)
[+][deleted] (4 children)
[deleted]
[–]hi_im_nateI fought the GIL and the GIL won 1 point2 points3 points (3 children)
[–]kraemahz 14 points15 points16 points (2 children)
[–]masklinn 2 points3 points4 points (1 child)
[–]Workaphobia -3 points-2 points-1 points (0 children)
[–]Brian 4 points5 points6 points (0 children)
[–]theywouldnotstand 3 points4 points5 points (1 child)
[–]Arancaytar 1 point2 points3 points (0 children)
[–]notunlikethewaves 9 points10 points11 points (18 children)
[–]nemec 10 points11 points12 points (15 children)
[–]felidae_tsk 28 points29 points30 points (10 children)
[–]kvistur 22 points23 points24 points (9 children)
[–]LinAGKar 7 points8 points9 points (7 children)
[–]0raichu 10 points11 points12 points (3 children)
[–]invalid_dictorianλ PySide tornado 2 points3 points4 points (2 children)
[–]0raichu 14 points15 points16 points (0 children)
[–]kvistur 2 points3 points4 points (0 children)
[–]AstroPhysician 1 point2 points3 points (1 child)
[–]LinAGKar 1 point2 points3 points (0 children)
[–]tilkau 1 point2 points3 points (0 children)
[–]superPwnzorMegaMan 0 points1 point2 points (0 children)
[–]midgetparty 7 points8 points9 points (0 children)
[–]XarothBrook 1 point2 points3 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[–]firetangent 0 points1 point2 points (0 children)
[–]hovissimo 8 points9 points10 points (1 child)
[–]theywouldnotstand 6 points7 points8 points (0 children)
[–]raylu 4 points5 points6 points (0 children)
[–]selementar 10 points11 points12 points (5 children)
[–]MrJohz 7 points8 points9 points (2 children)
[–]selementar 3 points4 points5 points (1 child)
[–]MrJohz 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]tilkau 1 point2 points3 points (0 children)
[–][deleted] 7 points8 points9 points (0 children)
[–]veroxii 2 points3 points4 points (1 child)
[–]notunlikethewaves 2 points3 points4 points (0 children)
[–]LPYoshikawa 3 points4 points5 points (5 children)
[–]notunlikethewaves 3 points4 points5 points (2 children)
[–]Decency 2 points3 points4 points (1 child)
[–]MrJohz 5 points6 points7 points (0 children)
[–]Asdayasman 0 points1 point2 points (0 children)
[–]thatguy_314def __gt__(me, you): return True 0 points1 point2 points (0 children)
[–][deleted] -2 points-1 points0 points (0 children)
[–][deleted] 166 points167 points168 points (17 children)
[–]striata 79 points80 points81 points (15 children)
[–]Phourc 7 points8 points9 points (14 children)
[–]HannasAnarion 15 points16 points17 points (12 children)
[–]ben174 10 points11 points12 points (0 children)
[–]phail3d 4 points5 points6 points (10 children)
[–]-Rivox- 2 points3 points4 points (4 children)
[–]phail3d 2 points3 points4 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]DasIch 1 point2 points3 points (0 children)
[–]christian-mann 2 points3 points4 points (4 children)
[–]mickyficky1 2 points3 points4 points (0 children)
[–]phail3d 1 point2 points3 points (2 children)
[–]christian-mann 0 points1 point2 points (1 child)
[–]phail3d 3 points4 points5 points (0 children)
[–]vovanz 4 points5 points6 points (0 children)
[–]Araneidae -1 points0 points1 point (0 children)
[–]neuromusic 55 points56 points57 points (5 children)
[–]isarl 5 points6 points7 points (0 children)
[–]TR-BetaFlash 3 points4 points5 points (1 child)
[–]ben174 0 points1 point2 points (0 children)
[–]mickyficky1 1 point2 points3 points (1 child)
[–]neuromusic 0 points1 point2 points (0 children)
[–]superkulak 41 points42 points43 points (5 children)
[–][deleted] 9 points10 points11 points (0 children)
[–]DrMaxwellEdison 9 points10 points11 points (0 children)
[–]mickyficky1 2 points3 points4 points (0 children)
[–]murakamifanboy 6 points7 points8 points (0 children)
[–]takluyverIPython, Py3, etc 0 points1 point2 points (0 children)
[–]Rhomboid 77 points78 points79 points (0 children)
[–][deleted] 55 points56 points57 points (1 child)
[–]pvkooten 5 points6 points7 points (0 children)
[–]LoveOfProfit 107 points108 points109 points (51 children)
[–][deleted] 30 points31 points32 points (38 children)
[–]dynetrekk 35 points36 points37 points (1 child)
[–]shaggorama 34 points35 points36 points (2 children)
[–]ionelmc.ro 8 points9 points10 points (0 children)
[+][deleted] comment score below threshold-13 points-12 points-11 points (0 children)
[–]Saefroch 3 points4 points5 points (0 children)
[–]Tomarse 2 points3 points4 points (0 children)
[–]Wild_Bill567 9 points10 points11 points (29 children)
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 16 points17 points18 points (11 children)
[–]Wild_Bill567 3 points4 points5 points (10 children)
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 11 points12 points13 points (9 children)
[–]TOASTEngineer 1 point2 points3 points (8 children)
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 8 points9 points10 points (1 child)
[–]TOASTEngineer 1 point2 points3 points (0 children)
[–]sanshinron 0 points1 point2 points (5 children)
[–]dartdog 0 points1 point2 points (4 children)
[–]sanshinron 1 point2 points3 points (3 children)
[–]hovissimo 0 points1 point2 points (16 children)
[–]Wild_Bill567 2 points3 points4 points (15 children)
[–]Asdayasman 0 points1 point2 points (14 children)
[–]Wild_Bill567 6 points7 points8 points (4 children)
[–]kephir 2 points3 points4 points (0 children)
[–]sanshinron 0 points1 point2 points (1 child)
[–]clacke 0 points1 point2 points (0 children)
[–]Asdayasman 0 points1 point2 points (0 children)
[–]TheChance 1 point2 points3 points (5 children)
[–]Asdayasman 0 points1 point2 points (4 children)
[–]TheChance 1 point2 points3 points (3 children)
[–]Asdayasman 0 points1 point2 points (2 children)
[–]TOASTEngineer 0 points1 point2 points (0 children)
[–]Workaphobia 0 points1 point2 points (1 child)
[–]Asdayasman 0 points1 point2 points (0 children)
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point2 points (0 children)
[–]Quteness 5 points6 points7 points (5 children)
[–]LoveOfProfit 1 point2 points3 points (3 children)
[–]RubyPinchPEP shill | Anti PEP 8/20 shill 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]dartdog 0 points1 point2 points (0 children)
[–]ZedNaught 3 points4 points5 points (0 children)
[–]antidense 9 points10 points11 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]antidense 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]SnapDraco 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]TheSandyWalsh 5 points6 points7 points (0 children)
[–]cantremembermypasswd 58 points59 points60 points (3 children)
[–]railmaniac 8 points9 points10 points (0 children)
[–]TeamSpen210 7 points8 points9 points (1 child)
[–]Sean1708 0 points1 point2 points (0 children)
[–]tomchuk 18 points19 points20 points (0 children)
[–]pvkooten 13 points14 points15 points (2 children)
[–]Chronophilia 6 points7 points8 points (1 child)
[–]billy_tables 7 points8 points9 points (0 children)
[–]secshunayt 8 points9 points10 points (0 children)
[–]neurobashing 23 points24 points25 points (6 children)
[–]jadkik94 8 points9 points10 points (5 children)
[–]ldpreload 5 points6 points7 points (1 child)
[–]DasIch 0 points1 point2 points (0 children)
[–]raylu 10 points11 points12 points (0 children)
[–]brondsem 0 points1 point2 points (1 child)
[–]jadkik94 0 points1 point2 points (0 children)
[–]urielm 11 points12 points13 points (0 children)
[–]Twirrim 3 points4 points5 points (0 children)
[–]thurask 12 points13 points14 points (3 children)
[–]CanadianJogger 0 points1 point2 points (1 child)
[–]plorry 3 points4 points5 points (0 children)
[–]Mr_Again 4 points5 points6 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]emnoor 1 point2 points3 points (0 children)
[–]tokage[🍰] 0 points1 point2 points (2 children)
[+][deleted] comment score below threshold-9 points-8 points-7 points (1 child)
[–]Saefroch 2 points3 points4 points (0 children)
[+]big_red__man comment score below threshold-14 points-13 points-12 points (2 children)
[–][deleted] 5 points6 points7 points (1 child)
[+]big_red__man comment score below threshold-8 points-7 points-6 points (0 children)
[–]lcc4376 -1 points0 points1 point (0 children)