title: shutting down computer (linux) using python
body: <p>I am trying to write a script that will shut down the computer if a few requirements are filled with the command</p>
  
  <pre><code>    os.system("poweroff")
  </code></pre>
  
  <p>also tried</p>
  
  <pre><code>    os.system("shutdown now -h")
  </code></pre>
  
  <p>and a few others. but nothing happens when I run it, the computer goes through the code without crashing or producing any error messages and terminates the script normally, without shutting down the computer.</p>
  
  <p>How does one shutdown the computer in python?</p>
  
  <p>edit:</p>
  
  <p>Seems that the commands I have tried requires root access. Is there any way to shut down the machine from the script without elevated privileges?</p>