Page MenuHome

Patch to Python uuid module to avoid CRT warning on Windows
Closed, ResolvedPublic


There is a bug in Python's uuid module that has been affecting official Blender releases on Windows for several years. It's triggered by Blender's inclusion of the CRT redistributables, and causes a runtime exception to be thrown when the module is first imported. It's harmless, but the OS "runtime error" window that appears is disconcerting for users and a thorn in the side of anyone whose addon uses uuid.


I've applied the fix suggested in Python's bug tracker, and it works just fine. It would be good to get it into the next Blender release.

The file is located at lib/*/release/python33.tar.gz/ I don't know how Git would handle changes to that file...perhaps a "patches" subdir and change to the INSTALL project would be appropriate?



Event Timeline

Tom Edwards (artfunkel) raised the priority of this task from to Needs Triage by Developer.
Tom Edwards (artfunkel) updated the task description. (Show Details)
Tom Edwards (artfunkel) set Type to Patch.
Tom Edwards (artfunkel) updated the task description. (Show Details)

Thomas, as Windows release manager, I think this one is for you :)

Bastien Montagne (mont29) lowered the priority of this task from Needs Triage by Developer to Normal.Jan 26 2014, 3:29 PM

Any chance to fix this upstream rather than hacking it on our side?

I also rather let vc2008 libs die and don't change them again. We will switch to vc2012 or 2013 after the 2.70 release.

Since I added Python 3.3 to the list of affected platforms the bug has been getting a bit of attention, but seeing as it was reported two years ago let's not hold our breath...

Some nasty workarounds...

import ctypes
import sys
sys.modules["ctypes"] = type(sys)("ctypes")  # dummy module, uuid can continue without it
import uuid
sys.modules["ctypes"] = ctypes
del ctypes, sys

Infact simply temp overwriting CDLL works

import ctypes
CDLL = ctypes.CDLL
ctypes.CDLL = None  # calls this this will fail, but python has a fallback
import uuid
ctypes.CDLL = CDLL
del ctypes, CDLL

With Python3.4x and MSVC2013, this is now resolved. closing.