Com powerpoint.Quit()函数不退出python-pptx中的Microsoft powerpoint。是否有退出的方法
由于我无法退出powerpoint,转换为pdf会给我带来问题。我使用的是pywin32 227版本和python 3.6.1 64位。python中是否有释放COM对象的功能。我已经为此工作了数周,但我在这里没有任何进展。如果您知道任何事情,请帮助mwCom powerpoint.Quit()函数不退出python-pptx中的Microsoft powerpoint。是否有退出的方法,com,powerpoint,python-pptx,Com,Powerpoint,Python Pptx,由于我无法退出powerpoint,转换为pdf会给我带来问题。我使用的是pywin32 227版本和python 3.6.1 64位。python中是否有释放COM对象的功能。我已经为此工作了数周,但我在这里没有任何进展。如果您知道任何事情,请帮助mw def convert(files, formatType=32): powerpoint = win32com.client.Dispatch("Powerpoint.Applicati
def convert(files, formatType=32):
powerpoint = win32com.client.Dispatch("Powerpoint.Application")
powerpoint.Visible = 1
print("ppt",powerpoint)
for filename in files:
newname = os.path.splitext(filename)[0] + ".pdf"
deck = powerpoint.Presentations.Open(filename)
deck.SaveAs(newname, formatType)
deck.Close()
powerpoint.Quit()# NOT ABLE TO QUIT POWERPOINT
files = glob.glob(path)
print(files)
convert(files)
print("after entering files")
os.remove(path)
您可以通过以下方式关闭任务:
导入操作系统
操作系统('taskkill/F/IM POWERPNT.EXE')