diff --git a/cloudbaseinit/shell.py b/cloudbaseinit/shell.py index 02d11814..ba08c723 100644 --- a/cloudbaseinit/shell.py +++ b/cloudbaseinit/shell.py @@ -12,11 +12,15 @@ # License for the specific language governing permissions and limitations # under the License. +import struct import sys -import pythoncom -sys.coinit_flags = pythoncom.COINIT_MULTITHREADED -pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) +if struct.calcsize("P") == 8 and sys.platform == 'win32': + # This is needed by Nano Server. + # Set COINIT_MULTITHREADED only on x64 interpreters due to issues on x86. + import pythoncom + sys.coinit_flags = pythoncom.COINIT_MULTITHREADED + pythoncom.CoInitializeEx(pythoncom.COINIT_MULTITHREADED) from oslo_config import cfg from oslo_log import log as oslo_logging