我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用win32com.client.gencache.GetGeneratePath()。
def GenerateChildFromTypeLibSpec(child, typelibInfo, verboseLevel = None, progressInstance = None, bUnicodeToString=None): assert bUnicodeToString is None, "this is deprecated and will go away" if verboseLevel is None: verboseLevel = 0 # By default, we use no gui, and no verbose level for the children. if type(typelibInfo)==type(()): typelibCLSID, lcid, major, minor = typelibInfo tlb = pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid) else: tlb = typelibInfo tla = typelibInfo.GetLibAttr() typelibCLSID = tla[0] lcid = tla[1] major = tla[3] minor = tla[4] spec = selecttlb.TypelibSpec(typelibCLSID, lcid, major, minor) spec.FromTypelib(tlb, str(typelibCLSID)) typelibs = [(tlb, spec)] if progressInstance is None: progressInstance = SimpleProgress(verboseLevel) progress = progressInstance for typelib, info in typelibs: dir_name = gencache.GetGeneratedFileName(info.clsid, info.lcid, info.major, info.minor) dir_path_name = os.path.join(gencache.GetGeneratePath(), dir_name) progress.LogBeginGenerate(dir_path_name) gen = genpy.Generator(typelib, info.dll, progress) gen.generate_child(child, dir_path_name) progress.SetDescription("Importing module") __import__("win32com.gen_py." + dir_name + "." + child) progress.Close()