[Bug 954595] Re: ImportError: cannot import name urandom from os

Barry Warsaw 954595 at bugs.launchpad.net
Fri Apr 27 20:03:43 UTC 2012


On Apr 27, 2012, at 07:02 PM, Scott Kitterman wrote:

>OK.  I added a task on ubuntu-release-notes.  Would you please draft
>something up?

Python 2.7.3 includes a fix for a security vulnerability affecting Python's
dict and set implementations.  Carefully crafted, untrusted input could lead
to extremely long computation times and denials of service.  Although disabled
by default, vulnerable applications such as CGI scripts can explicitly enable
"hash randomization" to prevent this exploit.  Due to implementation details
of this fix, virtualenvs created with older 2.7.x releases may not work with
2.7.3.  Specifically, the os module may not appear to have a urandom function.
This problem can be solved by recreating the broken virtualenvs with the newer
Python 2.7.3 version.

See http://bugs.python.org/issue13703 for full details.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python2.7 in Ubuntu.
https://bugs.launchpad.net/bugs/954595

Title:
  ImportError: cannot import name urandom from os

Status in Release Notes for Ubuntu:
  New
Status in “python2.7” package in Ubuntu:
  Invalid

Bug description:
  1) Description:	Ubuntu precise (development branch)
  Release:	12.04

  2) python2.7 2.7.3~rc1-1ubuntu2, libpython2.7 2.7.3~rc1-1ubuntu2,
  python2.7-minimal 2.7.3~rc1-1ubuntu2

  (tribune)niran at niran-MacPro:~/tribune/texastribune$ pip install -U fabric
  Traceback (most recent call last):
    File "/home/niran/.virtualenvs/tribune/bin/pip", line 9, in <module>
      load_entry_point('pip==1.0.2', 'console_scripts', 'pip')()
    File "/home/niran/.virtualenvs/tribune/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 337, in load_entry_point
      return get_distribution(dist).load_entry_point(group, name)
    File "/home/niran/.virtualenvs/tribune/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 2279, in load_entry_point
      return ep.load()
    File "/home/niran/.virtualenvs/tribune/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load
      entry = __import__(self.module_name, globals(),globals(), ['__name__'])
    File "/home/niran/.virtualenvs/tribune/local/lib/python2.7/site-packages/pip/__init__.py", line 10, in <module>
      from pip.backwardcompat import u, walk_packages, console_to_str
    File "/home/niran/.virtualenvs/tribune/local/lib/python2.7/site-packages/pip/backwardcompat.py", line 66, in <module>
      from urllib2 import URLError, HTTPError
    File "/usr/lib/python2.7/urllib2.py", line 94, in <module>
      import httplib
    File "/usr/lib/python2.7/httplib.py", line 79, in <module>
      import mimetools
    File "/usr/lib/python2.7/mimetools.py", line 6, in <module>
      import tempfile
    File "/usr/lib/python2.7/tempfile.py", line 34, in <module>
      from random import Random as _Random
    File "/usr/lib/python2.7/random.py", line 47, in <module>
      from os import urandom as _urandom
  ImportError: cannot import name urandom

  (tribune)niran at niran-MacPro:~/tribune/texastribune$ python
  Python 2.7.2+ (default, Aug 16 2011, 07:24:41)
  [GCC 4.6.1] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import os
  >>> os.urandom
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  AttributeError: 'module' object has no attribute 'urandom'

  Downgrading all three packages to 2.7.2-13ubuntu5 makes pip work
  again, and importing urandom from os succeeds as well.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-release-notes/+bug/954595/+subscriptions




More information about the foundations-bugs mailing list