Pywinauto TypeError:start()缺少1个必需的位置参数:'self'

时间:2018-08-06 10:22:52

标签: python pywinauto

你好,我遇到了一个问题:

import pywinauto
from pywinauto.application import Application
app = Application.start(cmd_line="C:\Folder\Wow.exe")

Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: start() missing 1 required positional argument: 'self'

我应该在代码中添加什么?

2 个答案:

答案 0 :(得分:3)

您需要实例化Application对象,然后在该对象上而不是在类上调用start。如the documentation所示:

app = Application(backend="uia").start('notepad.exe')

在您的情况下,我猜您需要win32后端,所以:

app = Application(backend="win32").start(cmd_line="C:\Folder\Wow.exe")

答案 1 :(得分:1)

app = Application()。start(cmd_line =“ C:\ Folder \ Wow.exe”)