4

I have disabled UAC and running my script in python.

command = "abcd.exe"
subprocess.Popen(command,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

Also, I set the application abcd.exe from its property to run as admin.

Then I'm getting the following error:

WindowsError: [Error 740] The requested operation requires elevation

Cœur
  • 37,241
  • 25
  • 195
  • 267
Binoy
  • 79
  • 1
  • 2
  • 6
  • Possible duplicate of [Request UAC elevation from within a Python script?](http://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script) – Mr_and_Mrs_D Sep 05 '16 at 15:10

2 Answers2

14

You could try using:

subprocess.call(["abcd.exe"], shell=True)

Basically the important part here is shell=True; if set to False, then you will get the following error.

WindowsError: [Error 740]

Harry
  • 87,580
  • 25
  • 202
  • 214
kfc.w.f.
  • 141
  • 1
  • 3
1

I believe that the problem is with using subprocess.Popen.

I also think that your question has already been answered here: Request UAC elevation from within a Python script?

Community
  • 1
  • 1
  • Thank you for replying.. :) The solution in [Request UAC elevation from within a Python script?](http://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script) worked for me.. – Binoy Mar 06 '13 at 08:32