[ python-Bugs-1021890 ] Import random fails

SourceForge.net noreply at sourceforge.net
Tue Sep 7 15:57:11 CEST 2004


Bugs item #1021890, was opened at 2004-09-03 11:31
Message generated for change (Comment added) made by plusk
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: Closed
Resolution: Fixed
Priority: 5
Submitted By: Paul D. Lusk (plusk)
Assigned to: Raymond Hettinger (rhettinger)
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.



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

>Comment By: Paul D. Lusk (plusk)
Date: 2004-09-07 09:57

Message:
Logged In: YES 
user_id=1083789

Sorry that it has taken me so long to reply. We did not have 
a patch that understood unified diffs. I have applied the 
random patch from the bugs page and make test is not 
reporting any problems any more. Thanks for the prompt fix.

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

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-09-05 07:48

Message:
Logged In: YES 
user_id=80475

Paul,

Can you please verify that the attached files run on your
system.

TIA,

Raymond


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

Comment By: Raymond Hettinger (rhettinger)
Date: 2004-09-03 15:10

Message:
Logged In: YES 
user_id=80475

Fixed.  
See:  LIb/random.py 1.66

Thanks for the prompt bug report.

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

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