While running nosetests, I get errors if no Excel is open when starting the tests.
Some debugging led me to an issue in the get_excel_hwnds function. The function win32gui.FindWindowEx is used in a if construct but in fact the function throws a pywintypes.error when it fails. I think the function should instead be
def get_excel_hwnds():
hwnds = []
win32gui.EnumWindows(lambda hwnd, result_list: result_list.append(hwnd), hwnds)
excel_hwnds = []
for hwnd in hwnds:
try:
win32gui.FindWindowEx(hwnd, 0, 'XLDESK', None)
except pywintypes.error:
pass
else:
excel_hwnds.append(hwnd)
return excel_hwnds
While running nosetests, I get errors if no Excel is open when starting the tests.
Some debugging led me to an issue in the get_excel_hwnds function. The function win32gui.FindWindowEx is used in a if construct but in fact the function throws a pywintypes.error when it fails. I think the function should instead be