title: How to run script with elevated privilege on windows
body: <p>I am writing a pyqt application which require to execute admin task. I would prefer to start my script with elevate privilege. I am aware that this question is asked many times in SO or in other forum. But the solution people are suggesting is to have a look at this SO question
  <a href="https://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script">Request UAC elevation from within a Python script?</a></p>
  
  <p>However, I am unable to execute the sample code given in the link. I have put this code on top of the main file and tried to execute it. </p>
  
  <pre><code>import os
  import sys
  import win32com.shell.shell as shell
  ASADMIN = 'asadmin'
  
  if sys.argv[-1] != ASADMIN:
      script = os.path.abspath(sys.argv[0])
      params = ' '.join([script] + sys.argv[1:] + [ASADMIN])
      shell.ShellExecuteEx(lpVerb='runas', lpFile=sys.executable, lpParameters=params)
      sys.exit(0)
  print "I am root now."
  </code></pre>
  
  <p>It actually ask permission to elevate but print line never get executed. Somebody can help me to run the above code successfully. Thanks in advance.</p>