Windows 7 SP1 64bit, NVidia GTX 580
Broken: 2.78c e92f235283
Short description of error
Having Blender started by a web worker, (blender.exe -b -noaudio scene.blend) the following error is thrown:
Fatal Python error: Py_Initialize: can't initialize sys standard streams OSError: [WinError 6] The handle is invalid Current thread 0x00002f78 (most recent call first):
Exact steps for others to reproduce the error
- Using VisualStudio create an empty WebAPI application.
- Prepare a Blender Scene with the following script, allow autorun of scripts
- On a GET request let it run Blender in a separate process and wait for it to finish rendering the scene (2.78 will dead-block, 2.76 will finish)
- Publish to IIS (do not use Visual Studio's internal IIS Express)
- Send the GET and see what happens
Due to a bug in Python 3.5.2 Blender will not even initialize and it will block the console with an error message. Make suer to redirect stderr properly to read the error (pasted above).
My solution was to replace the bundled Python with 3.5.3. I described it here: https://blender.stackexchange.com/questions/78259/blender-not-running-under-iis7
The problem was obviously introduced with Python 3.5 which was bundled since Blender 2.77. Fortunately Python 3.5.3 fixes it. I hope you will use 3.5.3 in the next Blender release :)