News for hackers. Stuff that matters.
Re:Python 2.x vs. 3.x use survey by viraptor on Wednesday December 10, 2014 @01:00PM (#8730586)
Your first version was already not correct/portable. When reading binary files on Windows, you have to include the binary mode. Otherwise you'll drop bytes semi-randomly.

This change only made that mistake visible on other systems.

Re:Python 2.x vs. 3.x use survey by ma2rten on Wednesday December 10, 2014 @01:04PM (#8730615)
There is no /dev/random on windows anyway. Not every piece of code has to be portable.
Re:Python 2.x vs. 3.x use survey by viraptor on Wednesday December 10, 2014 @01:14PM (#8730675)
It doesn't have to be, but going for a more correct/portable code (than absolutely necessary minimum) helps avoid such problems. In this case binary file was opened - if the "rb" mode was added anyway, the exception mentioned above wouldn't happen.

Edit: Actually python doesn't even mention windows. It's simply "Add a 'b' to the mode for binary files." (in python 2.7 documentation) According to the docs it should be specified regardless.

Re:Python 2.x vs. 3.x use survey by schoen on Wednesday December 10, 2014 @01:04PM (#8730618)
Yes, I definitely wouldn't have expected or intended that code to work on Windows.