[ python-Bugs-1021890 ] Import random fails

SourceForge.net noreply at sourceforge.net
Fri Sep 3 17:31:56 CEST 2004


Bugs item #1021890, was opened at 2004-09-03 11:31
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1021890&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Paul D. Lusk (plusk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Import random fails 

Initial Comment:
 uname -a
HP-UX voyager B.11.11 U 9000/800 3108770354 
unlimited-user license

import random fails.

There is no /dev/urandom on this machine, so
os.urandom raises:

NotImplementedError: /dev/urandom (or equivalent) not 
found

The code in random.py seems to expect that 
os.urandom exists that urandom will work.

Possible patch:

Change random.py so that that urandom usage
is setup like this:

try:
    from os import urandom as _urandom
    from binascii import hexlify as _hexlify
except ImportError:
    _urandom = None
else:
    try:
        _urandom(1)
    except NotImplementedError:
        _urandom = None


After this, import random works. test_random
still fails for the HardwareRandom tests, of course.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1021890&group_id=5470


More information about the Python-bugs-list mailing list