mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-03-14 09:28:03 -06:00
22 lines
408 B
Python
22 lines
408 B
Python
|
from pywintypes import com_error
|
||
|
from win32com.client import gencache
|
||
|
|
||
|
def prepare_gencache():
|
||
|
gencache.is_readonly = False
|
||
|
gencache.GetGeneratePath()
|
||
|
|
||
|
|
||
|
|
||
|
def load_com(*names):
|
||
|
result = None
|
||
|
for name in names:
|
||
|
try:
|
||
|
result = gencache.EnsureDispatch(name)
|
||
|
break
|
||
|
except com_error:
|
||
|
continue
|
||
|
if result is None:
|
||
|
raise com_error("Unable to load any of the provided com objects.")
|
||
|
return result
|
||
|
|