powerplay7.py 804 B

123456789101112131415161718192021222324
  1. import plac
  2. import subprocess
  3. import config
  4. cfg = config.Config()
  5. report_dir = cfg.portal_dir + '\\System\\Report'
  6. publish_dir = cfg.portal_dir + '\\daten'
  7. @plac.pos('report_file', '', type=str)
  8. @plac.opt('export_format', '', type=str)
  9. @plac.opt('publish_subdir', '', type=str)
  10. def export(report_file, export_format='pdf', publish_subdir=None):
  11. pub_dir = publish_dir if publish_subdir is None else f'{publish_dir}\\{publish_subdir}'
  12. cmd = f'"{cfg.cognos_dir}\\runmac32.exe" "{cfg.tools_dir}\\VBS\\powerplay-export.mac" "{report_dir}","{report_file}","{export_format}","{pub_dir}"'
  13. print(f"Exportiere '{report_file}' als '{export_format}' nach '{pub_dir}'...", end='')
  14. p = subprocess.Popen(cmd)
  15. p.wait()
  16. print('erfolgreich.')
  17. if __name__ == '__main__':
  18. plac.call(export)