Search code examples
pythonpywinauto

Pywinauto TypeError: start() missing 1 required positional argument: 'self'


Hello I faced a problem:

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'

What shall I add to code?


Solution

  • You need to instantiate the Application object and call start on that, not on the class. As the documentation shows:

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

    In your case I guess you need the win32 backend, so:

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