path存在代码Excel Python

我正在处理目录代码,如果文件存在于指定的path中,它将在Excel中运行一个macros。 对于我来说,我想这样做,如果path不在那里,文件将被master copy from the I drivemaster copy from the I drive保存到F驱动master copy from the I drive ,然后运行代码。 我怎样才能做到这一点?

 import os import os.path PATH='F:\Ten Year Load Forecasts 2017-2026.xlsm' Master_Copy='I:\Ten Year Load Forecasts 2017-2026.xlsm' if os.path.isfile(PATH) and os.access(PATH, os.R_OK): print "File exists and is readable" xlApp = win32com.client.DispatchEx('Excel.Application') # Running Excel xlsPath = os.path.expanduser('F:\Ten Year Load Forecats\Ten Year Load Forecasts 2017-2026.xlsm)# Reading xlsm file wb = xlApp.Workbooks.Open(Filename=xlsPath) # Opening file xlApp.Run('csvfile3')# Running macro---- csvfile3 is the macro name. It is under the "csv" module in the VBA editor wb.Save() xlApp.Quit() else: "Save Master_Copy to Path" "Repeat Function From above with running macro"