import logging import win32com.client from pathlib import Path class transformer7: def __init__(self): self.tr = win32com.client.Dispatch("CognosTransformer.Application") #self.tr.Visible(True) print(self.tr.Version) def open(self, file, format = None): filename = Path(file).resolve() #path = str(filename.parent.resolve()) print(filename) try: model = self.tr.OpenModel(filename) cube = model.Cubes.Item(1) cube.Update() model.CreateMDCFiles() except Exception as e: print(e) if __name__ == "__main__": transformer7().open("Model\\NW_GW_VK.pyi")