title: Using plyer with kivy. Weird errors.
body: <p>I have been trying to figure out what's wrong with this code:</p>
  
  <pre><code>from kivy.app import App
  from kivy.properties import ObjectProperty
  from kivy.uix.widget import Widget
  from kivy.clock import Clock
  from plyer.facades import accelerometer
  
  
  
  class Accel(Widget):
      def __init__(self):
          super().__init__()
          self.sensorEnabled = False
  
      def get_acceleration(self, dt):
          val = accelerometer.acceleration
  
          self.ids.label1.text = "X: " + str(val[0])
          self.ids.label2.text = "Y: " + str(val[1])
          self.ids.label3.text = "Z: " + str(val[2])
  
      def pressed1(self):
          try:
              if not self.sensorEnabled:
              # accelerometer.enable()
                  Clock.schedule_interval(self.get_acceleration, 1 / 20.)
                  self.sensorEnabled = True
                  self.ids.button1.text = "Stop"
              else:
                  # accelerometer.disable()
                  Clock.unschedule(self.get_acceleration)
                  self.sensorEnabled = False
                  self.ids.button1.text = "Start"
          except:
  
              self.ids.status.text = "Accelerometer not supported"
  
  
  class e3App(App):
      def build(self):
          return Accel()
  if __name__ == '__main__':
      e3App().run()
  </code></pre>
  
  <p>What happens is when I run it and press the START button it crashes and gives me this: </p>
  
  <pre><code>&gt; Traceback (most recent call last):    File
  &gt; "/usr/local/lib/python3.5/dist-packages/plyer/platforms/linux/accelerometer.py",
  &gt; line 22, in _get_acceleration
  &gt;      pos = glob.glob("/sys/devices/platform/*/position")[0]  IndexError: list index out of range    During handling of the above
  &gt; exception, another exception occurred:    Traceback (most recent call
  &gt; last):    File
  &gt; "/home/rickdps/Desktop/KivyCookBook/InputMotionAndTouch/WorkingWithAccelerometer/main.py",
  &gt; line 42, in &lt;module&gt;
  &gt;      e3App().run()    File "/usr/local/lib/python3.5/dist-packages/kivy/app.py", line 828, in run
  &gt;      runTouchApp()    File "/usr/local/lib/python3.5/dist-packages/kivy/base.py", line 504, in
  &gt; runTouchApp
  &gt;      EventLoop.window.mainloop()    File "/usr/local/lib/python3.5/dist-packages/kivy/core/window/window_sdl2.py",
  &gt; line 663, in mainloop
  &gt;      self._mainloop()    File "/usr/local/lib/python3.5/dist-packages/kivy/core/window/window_sdl2.py",
  &gt; line 405, in _mainloop
  &gt;      EventLoop.idle()    File "/usr/local/lib/python3.5/dist-packages/kivy/base.py", line 339, in
  &gt; idle
  &gt;      Clock.tick()    File "/usr/local/lib/python3.5/dist-packages/kivy/clock.py", line 581, in
  &gt; tick
  &gt;      self._process_events()    File "kivy/_clock.pyx", line 367, in kivy._clock.CyClockBase._process_events
  &gt; (/tmp/pip-build-rau3eo9p/kivy/kivy/_clock.c:7700)    File
  &gt; "kivy/_clock.pyx", line 397, in
  &gt; kivy._clock.CyClockBase._process_events
  &gt; (/tmp/pip-build-rau3eo9p/kivy/kivy/_clock.c:7577)    File
  &gt; "kivy/_clock.pyx", line 395, in
  &gt; kivy._clock.CyClockBase._process_events
  &gt; (/tmp/pip-build-rau3eo9p/kivy/kivy/_clock.c:7498)    File
  &gt; "kivy/_clock.pyx", line 167, in kivy._clock.ClockEvent.tick
  &gt; (/tmp/pip-build-rau3eo9p/kivy/kivy/_clock.c:3490)    File
  &gt; "/home/rickdps/Desktop/KivyCookBook/InputMotionAndTouch/WorkingWithAccelerometer/main.py",
  &gt; line 15, in get_acceleration
  &gt;      val = accelerometer.acceleration[:3]    File "/usr/local/lib/python3.5/dist-packages/plyer/utils.py", line 103, in
  &gt; __getattribute__
  &gt;      return getattr(object.__getattribute__(self, '_obj'), name)    File
  &gt; "/usr/local/lib/python3.5/dist-packages/plyer/facades/accelerometer.py",
  &gt; line 44, in acceleration
  &gt;      return self.get_acceleration()    File "/usr/local/lib/python3.5/dist-packages/plyer/facades/accelerometer.py",
  &gt; line 60, in get_acceleration
  &gt;      return self._get_acceleration()    File "/usr/local/lib/python3.5/dist-packages/plyer/platforms/linux/accelerometer.py",
  &gt; line 24, in _get_acceleration
  &gt;      raise Exception('Could not enable accelerometer!')  Exception: Could not enable accelerometer!
  </code></pre>
  
  <p>I am following this book called "Kivy Cook Book", and I've mostly copied and pasted code in order to try it. This one has not worked though. </p>
  
  <p>I'd really appreciate any help. </p>