title: Run python file as admin
body: <p>I'm trying to create a program that ask the user link of any websites to block it (in hosts)</p>
  <pre><code>import requests
  print('Time to block some websites')
  ask = input('&gt; Give me the link... ') ; link = {} # Ask user
  try:
      r = requests.get(ask) # Try the url 
      print('Protocol : ' , r.url [:r.url.find(&quot;:&quot;)]) # Check protocol of the url
      url = r.url 
      print('your url : ' , url)
  except:
      raise ValueError('Give the url with https/http', ask)
  
  url = url.split('/') ; urlist = list(url) # Split url 
  link.update({'linko': urlist[2]}) ; link.update({'host': '127.0.0.1 '}) # Add host and url to link
  x = link['linko'] ; y = link['host'] # Transform value of dict in string
  z = str(y+x) # Assign host and link
  
  f = open('hosts', 'a') # Open document in append mode
  f.write(z) ; f.write('\n') # Write z and newline for future use
  f.close() # Always close after use
  
  f = open('hosts' , 'r') # Open document in read mode
  print(f.read()) # Read document
  f.close() # Always close after use
  </code></pre>
  <p>Traceback :</p>
  <pre><code>  File &quot;C:\Windows\System32\drivers\etc\block.py&quot;, line 17, in &lt;module&gt;
      f = open('hosts', 'a') # Open document in append mode
  PermissionError: [Errno 13] Permission denied: 'hosts'
  </code></pre>
  <p>When I tried to execute the program with runas administrator :</p>
  <pre><code>RUNAS ERROR: Unable to run - C:\Windows\System32\drivers\etc\block.py
  193: C:\Windows\System32\drivers\etc\block.py is not a valid Win32 application. 
  </code></pre>
  <p>How do I get the program to have permissions to add sites to hosts?</p>