BlenderVR / source

Blender Virtual Reality Main Code
52 stars 21 forks source link

Daemon not launched on Windows, throwing "Fatal Python error: Failed to initialize Windows random API (CryptoGen)" #25

Open PyrApple opened 9 years ago

PyrApple commented 9 years ago

Run of blenderVR with powershell in a windows environment (by Vaclav Mares, beta tester) throws:


BlenderVR Log Window: 2015-02-20 22:44:22,317 blenderVR version: 1.0 2015-02-20 22:44:22,465 Creation of screen "console" 2015-02-20 22:44:22,479 Loading "Processor" class from "D:/My/BlenderVRBuild/samples/basic\basic.processor.py" as main processor 2015-02-20 22:44:22,481 Get loader script name: C:\Python34\python.exe D:\My\BlenderVRBuild\blender-vr\utils\update_loader.py --

D:/My/BlenderVRBuild/samples/basic/basic.blend

BlenderVR console: 2015-02-20 22:44:47,831 Command to run daemon: C:\Python34\python.exe D:\My\BlenderVRBuild\blender-vr\utils\daemon.py Washek-PC:31415 console debug 2015-02-20 22:44:47,831 Its environment variables: {}

2015-02-20 22:44:48,336 Cannot start daemon for screen 'console

PowerShell:

Fatal Python error: Failed to initialize Windows random API (CryptoGen)

It seems related to python issue: """ On Windows, if Python is started with an empty environment (no environment variable at all), Python fails with: "Fatal Python error: Failed to initialize Windows random API (CryptoGen)" """ http://bugs.python.org/issue20614

Next step: reproduce bug in windows env (may need to copy Valclav's PowerShell / Python config)

dfelinto commented 9 years ago

For the records, in the case of the Django project they fixed this issue like this: https://github.com/django/django/commit/5338ff4808c822a8b00e90154b884b7be3011e60

(I got the official python bug report via the Django report, while googling for it)

dfelinto commented 9 years ago

@PyrApple can you try the fix in the 'environment' branch to see if it helps? (c56c2534)

PyrApple commented 9 years ago

Solved,

One must define daemon related environment in the configuration file for Windows:

SystemRoot=C:\Windows

(see http://blender-vr-manual.readthedocs.org/components/configuration-file.html#daemon-sub-section)

Validated for:

dfelinto commented 9 years ago

Thanks David, this should still warn the user though. I'll look at that later

godbyk commented 8 years ago

I encountered this crash as well while using the provided main-dk2.xml configuration file in Windows. As @PyrApple pointed out, the following block was missing from the /computers/system/ section:

      <daemon transmit='True'>
        <environment>SystemRoot=C:/Windows</environment>
      </daemon>