ImportError: cannot import name COMError in python
问题 I am trying to convert docx file to pdf with following code import sys import os import comtypes.client wdFormatPDF = 17 in_file = os.path.abspath(sys.argv[1]) out_file = os.path.abspath(sys.argv[2]) word = comtypes.client.CreateObject('Word.Application') doc = word.Documents.Open(in_file) doc.SaveAs(out_file, FileFormat=wdFormatPDF) doc.Close() word.Quit() It is throwing an error ImportError: cannot import name COMError I have installed comtypes package. I am very new to python, I can not