[python-win32] Importing tempfile (or random) results in disaster...

Kevin Horn kevin.horn at gmail.com
Thu May 31 15:40:42 CEST 2012


I'm setting up a new machine (Win7) and one of the first things I thought
I'd do is install Python, distribute, pip, virtualenv, etc.

However, I can't seem to get that far.

When trying to install distribute (using distribute_setup.py), I get the
following traceback:

Traceback (most recent call last):
  File "distribute_setup.py", line 20, in <module>
    import tempfile
  File "C:\Python27\lib\tempfile.py", line 34, in <module>
    from random import Random as _Random
  File "C:\Python27\lib\random.py", line 881, in <module>
    _inst = Random()
  File "C:\Python27\lib\random.py", line 97, in __init__
    self.seed(x)
  File "C:\Python27\lib\random.py", line 111, in seed
    a = long(_hexlify(_urandom(16)), 16)
WindowsError: [Error -2146893818] Invalid Signature

"Huh," I thought.  "That's weird".

A little googling turned up this bug:

http://bugs.python.org/issue13524

Which has the same traceback, but purports to have something to do with not
passing the right environment to the subprocess module (and is marked as
"Wontfix").

But this doesn't seem to me to be the problem, as I'm not using the
subprocess module.  In fact, here is the minimal reproducible example on my
machine:

tfile.py:
import tempfile



That's it.  Just "import tempfile" and Python comes to a screeching halt.
In fact, "import random" does this as well, and either one will also cause
the traceback from within the interactive interpreter.

What's going on here?  Is this a Win7 thing?  I have 2.7.3 working on XP
and Vista without a problem.

Any pointers?

Kevin Horn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120531/a5f325cf/attachment.html>


More information about the python-win32 mailing list