“Windows Error: provider DLL failed to initialize correctly” on import of cgi module in frozen wxpython app

前端 未结 3 789
遥遥无期
遥遥无期 2021-01-18 06:41

I have a user of a frozen wxpython app that gets the appended screenshot.

The error message is \"Windows Error: provider DLL failed to initialize correctly\"

3条回答
  •  臣服心动
    2021-01-18 07:39

    For me, the exact error message was:

    WindowsError: [Error -2146893795] Provider DLL failed to initialize correctly

    with a trace such as:

      File "C:\Dev\Python\python-2.7.11\lib\tempfile.py", line 35, in 
        from random import Random as _Random
      File "C:\Dev\Python\python-2.7.11\lib\random.py", line 885, in 
        _inst = Random()
      File "C:\Dev\Python\python-2.7.11\lib\random.py", line 97, in __init__
        self.seed(x)
      File "C:\Dev\Python\python-2.7.11\lib\random.py", line 113, in seed
        a = long(_hexlify(_urandom(2500)), 16)
    WindowsError: [Error -2146893795] Provider DLL failed to initialize correctly
    

    And what solved it for me was a comment from http://bugs.python.org/issue1384175 (http://bugs.python.org/msg248947), saying the following:

    This happened at a call to `os.urandom` for me.
    This was in a subprocess.
    
    The bug for me was that I called `_subprocess.CreateProcess` 
    with an `env_mapper = {'foo': 'bar'}`. The fix:
    
        env_mapper = os.environ.copy()
        env_mapper.update({'foo': 'bar'})
    

提交回复
热议问题