This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Import random fails
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: plusk, rhettinger
Priority: normal Keywords:

Created on 2004-09-03 15:31 by plusk, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
random.py rhettinger, 2004-09-05 11:48 random.py
test_random.py rhettinger, 2004-09-05 11:50 Lib/test/test_random.py
Messages (7)
msg22335 - (view) Author: Paul D. Lusk (plusk) Date: 2004-09-03 15:31
 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.

msg22336 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-09-03 19:10
Logged In: YES 
user_id=80475

Fixed.  
See:  LIb/random.py 1.66

Thanks for the prompt bug report.
msg22337 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-09-05 11:48
Logged In: YES 
user_id=80475

Paul,

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

TIA,

Raymond
msg22338 - (view) Author: Paul D. Lusk (plusk) Date: 2004-09-07 13:57
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.
msg22339 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-09-07 16:20
Logged In: YES 
user_id=80475

Glad to hear the bugs patch worked for you.

Afterwards, I made further updates.  Would appreciate it if
you click on this bug report and get the two new files from
SF and make sure they work on your machine.
msg22340 - (view) Author: Paul D. Lusk (plusk) Date: 2004-09-07 16:54
Logged In: YES 
user_id=1083789

I've download the attached files and run make test. All okay.
msg22341 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2004-09-09 00:21
Logged In: YES 
user_id=80475

Thx.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40861
2004-09-03 15:31:56pluskcreate