* Holger Levsen <[email protected]>, 2014-08-01, 22:57:
[16:40] < Pepper>  Hi! Is there a regression in python2.6?
[16:40] < Pepper> I'm getting File "/usr/lib/python2.6/random.py", line 47, in <module>
[16:40] < Pepper>  from os import urandom as _urandom
[16:40] < Pepper>  ImportError: cannot import name urandom
[16:40] < Pepper> Happens on lts version: python2.6_2.6.6-8+deb6u1

In the old version of python2.6 the urandom() function was implemented directly in os.py. But in the new version, os.py imports it from the posix module.

So this exception could happen when "os" and "posix" modules are out of sync: "os" already wants posix's urandom, but "posix" doesn't have it yet.

So, how could the get out of sync? I'm not sure.

Google says most often the culprit is using virtualenv.
I could also reproduce it with the following sequence:

1) run "python 2.6 -S" (loads "posix", wich is a built-in module, but not "os")
2) upgrade python2.6
3) import random

--
Jakub Wilk


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: https://lists.debian.org/[email protected]

Reply via email to