Kod: Zaznacz cały
456
--> -->
<type 'exceptions.RuntimeError'> Python 2.7.9: /usr/bin/python
Sun Jan 15 18:02:21 2017
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/usr/lib/cgi-bin/b.py in ()
11 print '<h1>456</h1>'
12
=> 13 led = LED(17)
14 led.on()
15 sleep(1)
led undefined, LED = <class 'gpiozero.output_devices.LED'>
/usr/lib/python2.7/dist-packages/gpiozero/devices.py in __call__(cls=<class 'gpiozero.output_devices.LED'>, *args=(17,), **kwargs={})
133 else:
134 # Construct the instance as normal
=> 135 self = super(GPIOMeta, cls).__call__(*args, **kwargs)
136 # At this point __new__ and __init__ have all been run. We now fix the
137 # set of attributes on the class by dir'ing the instance and creating a
self undefined, builtin super = <type 'super'>, global GPIOMeta = <class 'gpiozero.devices.GPIOMeta'>, cls = <class 'gpiozero.output_devices.LED'>, ).__call__ = <bound method GPIOMeta.__call__ of <class 'gpiozero.output_devices.LED'>>, args = (17,), kwargs = {}
/usr/lib/python2.7/dist-packages/gpiozero/output_devices.py in __init__(self=<gpiozero.LED object closed>, pin=17, active_high=True, initial_value=False)
129 def __init__(self, pin=None, active_high=True, initial_value=False):
130 self._blink_thread = None
=> 131 super(DigitalOutputDevice, self).__init__(pin, active_high, initial_value)
132 self._controller = None
133
builtin super = <type 'super'>, global DigitalOutputDevice = <class 'gpiozero.output_devices.DigitalOutputDevice'>, self = <gpiozero.LED object closed>, ).__init__ = <bound method LED.__init__ of <gpiozero.LED object closed>>, pin = 17, active_high = True, initial_value = False
/usr/lib/python2.7/dist-packages/gpiozero/output_devices.py in __init__(self=<gpiozero.LED object closed>, pin=17, active_high=True, initial_value=False)
39 """
40 def __init__(self, pin=None, active_high=True, initial_value=False):
=> 41 super(OutputDevice, self).__init__(pin)
42 self._lock = Lock()
43 self.active_high = active_high
builtin super = <type 'super'>, global OutputDevice = <class 'gpiozero.output_devices.OutputDevice'>, self = <gpiozero.LED object closed>, ).__init__ = <bound method LED.__init__ of <gpiozero.LED object closed>>, pin = 17
/usr/lib/python2.7/dist-packages/gpiozero/mixins.py in __init__(self=<gpiozero.LED object closed>, *args=(17,), **kwargs={})
67 self._source_thread = None
68 self._source_delay = 0.01
=> 69 super(SourceMixin, self).__init__(*args, **kwargs)
70
71 def close(self):
builtin super = <type 'super'>, global SourceMixin = <class 'gpiozero.mixins.SourceMixin'>, self = <gpiozero.LED object closed>, ).__init__ = <bound method LED.__init__ of <gpiozero.LED object closed>>, args = (17,), kwargs = {}
/usr/lib/python2.7/dist-packages/gpiozero/devices.py in __init__(self=<gpiozero.LED object closed>, pin=17)
380 raise GPIOPinMissing('No pin given')
381 if isinstance(pin, int):
=> 382 pin = pin_factory(pin)
383 with _PINS_LOCK:
384 if pin in _PINS:
pin = 17, global pin_factory = <class 'gpiozero.pins.rpigpio.RPiGPIOPin'>
/usr/lib/python2.7/dist-packages/gpiozero/pins/rpigpio.py in __new__(cls=<class 'gpiozero.pins.rpigpio.RPiGPIOPin'>, number=17)
102 self._when_changed = None
103 self._edges = GPIO.BOTH
=> 104 GPIO.setup(self._number, GPIO.IN, self.GPIO_PULL_UPS[self._pull])
105 cls._PINS[number] = self
106 return self
global GPIO = <module 'RPi.GPIO' from '/usr/lib/python2.7/dist-packages/RPi/GPIO/__init__.pyc'>, GPIO.setup = <built-in function setup>, self = GPIO17, self._number = 17, GPIO.IN = 1, self.GPIO_PULL_UPS = {u'down': 21, u'floating': 20, u'up': 22}, self._pull = u'floating'
<type 'exceptions.RuntimeError'>: No access to /dev/mem. Try running as root!
args = ('No access to /dev/mem. Try running as root!',)
message = 'No access to /dev/mem. Try running as root!'