#!/usr/bin/python import RPi.GPIO as GPIO import time import subprocess GPIO.setmode(GPIO.BOARD) # set pin 16 to input, and enable the internal pull-up resistor GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP) oldButtonState1 = True while True: buttonState1 = GPIO.input(16) if buttonState1 != oldButtonState1 and buttonState1 == False : # print "Button 1 pressed" subprocess.call("halt", shell=True, stdout=subprocess.PIPE, stderr=subp$ oldButtonState1 = buttonState1 time.sleep(.1) --------------------------------- RETURNS --------------------------------- pi@raspberrypi2-no2:~$ sudo python haltButton.py Traceback (most recent call last): File "haltButton.py", line 2, in import RPi.GPIO as GPIO RuntimeError: This module can only be run on a Raspberry Pi!