Index: Lib/os.py =================================================================== --- Lib/os.py (revision 66037) +++ Lib/os.py (working copy) @@ -754,7 +754,7 @@ except (OSError, IOError): raise NotImplementedError("/dev/urandom (or equivalent) not found") bytes = "" - while len(bytes) < n: + while len(bytes) < int(n): bytes += read(_urandomfd, n - len(bytes)) close(_urandomfd) return bytes