I have the below error calling a macro via python using xlwings
"pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147352562), None)"
My full code: it opens the latest CSV file in downloads folder and runs macro on it
import glob
import os
from subprocess import Popen
import os, os.path
list_of_files = glob.glob('C:/Users/Martina/Downloads/*.csv')
latest_csv_file = max(list_of_files, key=os.path.getctime)
print(latest_csv_file)
file_name =latest_csv_file
os.startfile(file_name)
import xlwings as xw
wb = xw.Book(r'C:\Work\Automation\Resources\Personal All MAcro codes.xlsb')
your_macro = wb.macro('Iwebsite')
your_macro(1,2)