AutoGui:打开特定的docx文件会导致错误

时间:2019-04-07 08:53:17

标签: python pyautogui

我想使用pyAutoGui打开现有的docx文件来执行一些自动化任务。但是open方法会导致错误。

代码是:

from autogui import *


open("C:\\Users\\xxx\\Desktop\\folder\\output.docx", setActive=True)


write("This is AutoGui ","Text Editor")

它引起的错误是:

Traceback (most recent call last):
File "C:/Users/xxx/Desktop/folder/app.py", line 4, in <module>
open("C:\\Users\\xxx\\Desktop\\folder\\output.docx", setActive=True)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python36\lib\site-packages\autogui\__init__.py", line 32, in open
gl.Open(app,setActive)
System.InvalidOperationException: Process has exited, so the requested information is not available.
at System.Diagnostics.Process.EnsureState(State state)
at System.Diagnostics.Process.get_ProcessName()
at GUILibrary.GUILibraryClass.Open(String app, Boolean setActive, Double timeout)

有人知道如何解决此错误吗?

0 个答案:

没有答案