Initialize the COM libraries for the calling thread.


Apart from the error handling semantics, this is equivalent to pythoncom::CoInitializeEx(pythoncom.COINIT_APARTMENTTHREADED). See pythoncom::CoInitializeEx for a description.

Return Value

This function will ignore the RPC_E_CHANGED_MODE error, as that error indicates someone else beat you to the initialization, and did so with a different threading model. This error is ignored as it still means COM is ready for use on this thread, and as this function does not explicitly specify a threading model the caller probably doesn't care what model it is.
All other COM errors will raise pythoncom.error as usual. Use pythoncom::CoInitializeEx if you also want to handle the RPC_E_CHANGED_MODE error.