[Python-Dev] is this a bug? no environment variables

Glenn Linderman v+python at g.nevcal.com
Tue Nov 23 11:30:31 CET 2010

On 11/22/2010 8:33 AM, Guido van Rossum wrote:
> On Sun, Nov 21, 2010 at 9:40 PM, Glenn Linderman<v+python at g.nevcal.com>  wrote:
>> >  In reviewing my notes from my experimentations with CGIHTTPServer
>> >  (Python2.6) and then http.server (Python 3.2a4), I note one behavior I
>> >  haven't reported as a bug, nor do I know where to start to figure it out,
>> >  other than experimentally.
>> >
>> >  The experiment: launching CGIHTTPServer without environment variables, by
>> >  the simple expedient of using a batch file to unset all the existing
>> >  environment variables, and then launching Python2.6 with CGIHTTPServer.
>> >
>> >  So it failed early: random.py fails at line 110 (Python 2.6).
> What specific traceback do you get? In my copy of the code that line says
>                  a = long(_hexlify(_urandom(16)), 16)
> and I could just imagine that _urandom() fails for some reason to do
> with the environment (it is a reference to os.urandom()), which, being
> part of the C library code, might depend on the environment.
> But you're not giving enough info to debug this.

OK, here is the traceback.  I've upgraded the application from Python 
2.6 + CGIHTTPServer.py + bugfixes to Python 3.2a4 + http.server + 
bugfixes, hoping that it would fix it, but since it didn't that the 
traceback would be more relevant.  It seems that _urandom is the likely 

Traceback (most recent call last):
   File "d:\my\web\areliabl\0test\https.py", line 5, in <module>
     import server
   File "d:\my\web\areliabl\0test\server.py", line 88, in <module>
     import email.message
   File "C:\Python32\lib\email\message.py", line 17, in <module>
     from email import utils
   File "C:\Python32\lib\email\utils.py", line 27, in <module>
     import random
   File "C:\Python32\lib\random.py", line 698, in <module>
     _inst = Random()
   File "C:\Python32\lib\random.py", line 90, in __init__
   File "C:\Python32\lib\random.py", line 108, in seed
     a = int.from_bytes(_urandom(32), 'big')
WindowsError: [Error -2146893818] Invalid Signature
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20101123/0e18c030/attachment.html>

More information about the Python-Dev mailing list