transformer7.py 750 B

12345678910111213141516171819202122232425262728
  1. import logging
  2. import win32com.client
  3. from pathlib import Path
  4. class transformer7:
  5. def __init__(self):
  6. self.app = win32com.client.Dispatch("CognosPowerPlay.Report") # "CognosTransformer.Application")
  7. print(self.app)
  8. self.app.visible = 1
  9. print(self.app.Version)
  10. def open(self, file, format = None):
  11. filename = Path(file).resolve()
  12. #path = str(filename.parent.resolve())
  13. print(filename)
  14. try:
  15. model = self.app.OpenModel(filename)
  16. cube = model.Cubes.Item(1)
  17. cube.Update()
  18. model.CreateMDCFiles()
  19. except Exception as e:
  20. print(e)
  21. if __name__ == "__main__":
  22. transformer7().open("Model\\NW_GW_VK.pyi")