[Python-modules-team] Bug#665776: AttributeError: 'module' object has no attribute 'urandom'

Andrey Rahmatullin wrar at wrar.name
Mon Jul 9 11:43:30 UTC 2012


On Mon, Mar 26, 2012 at 03:18:19AM +0500, Boris Bobrov wrote:
> Package: python2.7
> Version: 2.7.3~rc2-1
> Severity: normal
> 
> Dear Maintainer,
> 
> After upgrade from 2.7.2-10 to 2.7.3~rc2-1 os.urandom disappeared in python
> executables, stored in virtualenvs:
> 
> ----
> (env)breton ~/src/cm/cm % which python
> /home/breton/src/cm/env/bin/python
> (env)breton ~/src/cm/cm % python
> Python 2.7.2+ (default, Oct  4 2011, 15:44:37)
> >>> import os
> >>> os.urandom
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   AttributeError: 'module' object has no attribute 'urandom'
> >>>
> 
> (env)breton ~/src/cm/cm % deactivate 
> breton ~/src/cm/cm % python
> Python 2.7.3rc2 (default, Mar 21 2012, 16:14:45)
> >>> import os
> >>> os.urandom
> <built-in function urandom>
> >>>
From http://www.virtualenv.org/en/latest/news.html :

Warning: Python bugfix releases 2.6.8, 2.7.3, 3.1.5 and 3.2.3 include a
change that will cause “import random” to fail with “cannot import name
urandom” on any virtualenv created on a Unix host with an earlier release
of Python 2.6/2.7/3.1/3.2, if the underlying system Python is upgraded.
This is due to the fact that a virtualenv uses the system Python’s
standard library but contains its own copy of the Python interpreter, so
an upgrade to the system Python results in a mismatch between the version
of the Python interpreter and the version of the standard library. It can
be fixed by removing $ENV/bin/python and re-running virtualenv on the same
target directory with the upgraded Python.


That is, again, what you get when you copy distribution-provided files :-/

-- 
WBR, wRAR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20120709/e7304198/attachment.pgp>


More information about the Python-modules-team mailing list