The following code results in a COM error, due to the Pathlib object being passed directly to the COM method. IT would be good if the wrapper could convert Pathlib objects to strings internally.
pdf_filename = output_directory / f"{file.stem}.pdf" # Pathlib object
ws.save_as(pdf_filename)
> com_error: (-2147352567, 'Exception occurred.', (0, 'mscorlib', 'Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))', None, 0, -2147467260), None)
As an interim, manually converting the Pathlib object to a string works fine.
ws.save_as(str(pdf_filename))