From: Raymond Hettinger Date: Fri, 3 Sep 2004 19:09:22 +0000 (+0000) Subject: SF bug #1022010: Import random fails X-Git-Tag: v2.4b1~348 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bdbdfd731dc2bf4b5490254c0df4b7c7e90ef751;p=python SF bug #1022010: Import random fails * trap NotImplementedError raised by os.urandom calls when not available on a particular system. --- diff --git a/Lib/random.py b/Lib/random.py index 0047c9137a..e6f6e4b5d9 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -62,7 +62,8 @@ RECIP_BPF = 2**-BPF try: from os import urandom as _urandom from binascii import hexlify as _hexlify -except ImportError: + _urandom(1) # verify that urandom is implemented +except (ImportError, NotImplementedError): _urandom = None