Run Python Script on computer boot

Use a plist like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.username.scriptname</string>    
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/python</string>
    <string>/path/to/script.py</string>
  </array>    
  <key>RunAtLoad</key>
  <true/>    
  <key>StandardErrorPath</key>
  <string>/tmp/com.username.scriptname.err</string>    
  <key>StandardOutPath</key>
  <string>/tmp/com.username.scriptname.out</string>
</dict>
</plist>

Just make sure you replace the /path/to/script.py accordingly and then save it to your desktop. Then open up terminal and type sudo chown root:wheel /path/to/plistfile it will prompt for password type it in in and when you are typing it it won't give you any visual feedback then press enter. Then type sudo chmod 644 /path/to/.plistfile. Then just sudo mv ... the plist file in /Library/LaunchDaemons/ or /Library/LaunchAgents/ and finally sudo launchctl load ... the plist and your script will run.

And if you have any problem comment below and also tell me the OS your Mac is running.