Skip to content

Pathlib object argument to ws.save_as() causes a COM Error #14

@mmwnifty

Description

@mmwnifty

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))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions