linusg / rpi-backlight

🔆 A Python module for controlling power and brightness of the official Raspberry Pi 7" touch display
https://rpi-backlight.readthedocs.io
MIT License
276 stars 32 forks source link

PermissionError: [Errno 13] Permission denied: '/sys/class/backlight/rpi_backlight/brightness' #38

Closed Marco-exports closed 3 years ago

Marco-exports commented 3 years ago

Inside Python3 I typed:

>>> backlight.brightness = 50

Result:

Traceback (most recent call last): File "", line 1, in File "/home/pi/.local/lib/python3.7/site-packages/rpi_backlight/init.py", line 207, in brightness self._set_value("brightness", self._denormalize_brightness(value)) File "/home/pi/.local/lib/python3.7/site-packages/rpi_backlight/init.py", line 100, in _set_value raise e File "/home/pi/.local/lib/python3.7/site-packages/rpi_backlight/init.py", line 96, in _set_value (self._backlight_sysfs_path / name).write_text(str(value)) File "/usr/lib/python3.7/pathlib.py", line 1218, in write_text with self.open(mode='w', encoding=encoding, errors=errors) as f: File "/usr/lib/python3.7/pathlib.py", line 1186, in open opener=self._opener) File "/usr/lib/python3.7/pathlib.py", line 1039, in _opener return self._accessor.open(self, flags, mode) PermissionError: [Errno 13] Permission denied: '/sys/class/backlight/rpi_backlight/brightness'

linusg commented 3 years ago

Installation

Note: Create this udev rule to update permissions, otherwise you'll have to run Python code, the GUI and CLI as root when changing the power or brightness

Marco-exports commented 3 years ago

what is a UDEV rule ?

Where do I find this in your instructions ?