From bdbdfd731dc2bf4b5490254c0df4b7c7e90ef751 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Fri, 3 Sep 2004 19:09:22 +0000 Subject: SF bug #1022010: Import random fails * trap NotImplementedError raised by os.urandom calls when not available on a particular system. --- Lib/random.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/random.py b/Lib/random.py index 0047c91..e6f6e4b 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 -- cgit v0.12