Search code examples
python-3.xwindowspywinauto

Facing issue with Install desktop application using pywinauto


I am trying to install desktop application using exe file in python script. I am trying to use pywinauto package. Facing below issue

app = Application(backend="win32").start(cmd_line=r'C:\Users\smsa\Downloads\xxx.exe')
  File "C:\Users\smsa\PycharmProjects\venv\lib\site-packages\pywinauto\application.py", line 1052, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "C:\Users\smsa\Downloads\ClearPassOnGuardInstall.exe"
Error returned by CreateProcess: (740, 'CreateProcess', 'The requested operation requires elevation.')

Process finished with exit code 1

Can someone suggest to help me on this. I did start in a correct way or should i use someother package please refer

I am trying to install desktop application using exe file in python script. I am trying to use pywinauto package. Facing below issue

app = Application(backend="win32").start(cmd_line=r'C:\Users\smsa\Downloads\xxx.exe')
  File "C:\Users\smsa\PycharmProjects\venv\lib\site-packages\pywinauto\application.py", line 1052, in start
raise AppStartError(message)
pywinauto.application.AppStartError: Could not create the process "C:\Users\smsa\Downloads\ClearPassOnGuardInstall.exe"
 Error returned by CreateProcess: (740, 'CreateProcess', 'The requested operation requires elevation.')

trying to automate desktop application for Windows.


Solution

  • The error message is pretty obvious: "The requested operation requires elevation" means you need to run the Python script (or higher level script) as Administrator and manually say "Yes" to UAC confirmation. If you want to disable UAC in Windows OS settings and automatically elevate privileges for the installer, it's another question that can be easily googled in ActiveState recipes.