MSVC 2011 - 2012 bug: Blender Startup Failure when called from a process without SDOUT (Python crashes)
Closed, ResolvedPublic

Description

Blender Version
Broken: Blender on Windows built with MSVC 11.0 or later (includes 2.71 release)
Worked: 2.70a and earlier

When Blender is called from a subprocess with no STDOUT available, the Py_Initialize procedure will cause a fatal error, due to a bug in more recent MSVC versions. (This issue will be fixed in MSVC 14)

The respective Issue on the Python Tracker:
http://bugs.python.org/issue17797

This breaks the Auto-Import functionality for blend files in Unity (unity3d.com), where a .blend dropped in an asset directory will be automatically converted to FBX by calling the Blender executable (and the FBX exporter python module).

I can confirm that a possible workaround outlined at http://bugs.python.org/issue17797#msg201964 fixes the issue. This would imply modifying pythonrun.c and replacing the Python34.dll with a modified version.

Ignacio (Ignaramus) updated the task description. (Show Details)
Ignacio (Ignaramus) raised the priority of this task from to Needs Triage.
Ignacio (Ignaramus) set Type to Bug.

Fixed DLL for 32-Bit Windows

Fixed DLL for 64-Bit Windows

Thanks for tracking that issue down!

Adding our py & win maintainers here too.

I doubt we’ll ever agree to distribute a patched version of python with our Blender but at least users that really need that feature from Unity now have a workaround… I’d bet this report will stay open for quite a bit of time (thanks M$).

PS: There may be another way around that issue, though, less intrusive - python can call processes with its own stdin/out/err, so a simple modification of Unity script to feature such fake streams might solve it, without having to replace whole py dll?

Bastien Montagne (mont29) triaged this task as Normal priority.

The Blender process itself crashes on Python Initialization, so there is no hope to have the script run in the first place, Unity itself does not use Python. They should be able to work around this, depending on how they handle subprocesses, but not a simply as that.

Ah ok… well, yes, not so simple in this case, indeed :/

Bastien Montagne (mont29) renamed this task from Blender Startup Failure on Windows when called from a process without SDOUT (Broken Unity Blender Auto-Import) to MSVC 2011 - 2012 bug: Blender Startup Failure when called from a process without SDOUT (Python crashes).Jul 2 2014, 4:05 PM
Bastien Montagne (mont29) lowered the priority of this task from Normal to Low.

Set prio to 'Low', because we can’t do anything really here. I think it’s worth keeping it open though, so other users hitting the issue can find it (and the workaround)…