You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system: RPiOS Bookwork lite 64bit
Python version: 3.11.2
Pi model: Pi 5
GPIO Zero version: 2.0
Pin factory used: default / lgpio
Trying to run a gpiozero script from a directory where the user doesn't have write permissions fails miserably as lgpio tries to create a named pipe in that directory. eg:
fromgpiozeroimportButtonb5=Button(5)
Then run this script eg as user pi from the root directory
pi@raspberrypi:~ $ cd /
pi@raspberrypi:/ $ python3 ~/gpiotest.py
2024-01-09 14:52:43 xCreatePipe: Can't set permissions (436) for //.lgd-nfy0, No such file or directory
/usr/lib/python3/dist-packages/gpiozero/devices.py:295: PinFactoryFallback: Falling back from lgpio: [Errno 2] No such file or directory: '.lgd-nfy-3'
warnings.warn(
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 408, in pin
pin = self.pins[info]
~~~~~~~~~^^^^^^
KeyError: PinInfo(number=29, name='GPIO5', names=frozenset({'GPIO5', 5, 'BOARD29', 'WPI21', '5', 'J8:29', 'BCM5'}), pull='', row=15, col=1, interfaces=frozenset({'', 'dpi', 'spi', 'gpio', 'uart', 'i2c'}))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/gpiotest.py", line 3, in <module>
b5 = Button(5)
^^^^^^^^^
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 103, in __call__
self = super().__call__(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/gpiozero/input_devices.py", line 412, in __init__
super().__init__(
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 417, in __init__
super().__init__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/input_devices.py", line 162, in __init__
super().__init__(
File "/usr/lib/python3/dist-packages/gpiozero/mixins.py", line 243, in __init__
super().__init__(*args, **kwargs)
File "/usr/lib/python3/dist-packages/gpiozero/input_devices.py", line 79, in __init__
super().__init__(pin, pin_factory=pin_factory)
File "/usr/lib/python3/dist-packages/gpiozero/devices.py", line 549, in __init__
pin = self.pin_factory.pin(pin)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/gpiozero/pins/pi.py", line 410, in pin
pin = self.pin_class(self, info)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/gpiozero/pins/rpigpio.py", line 101, in __init__
GPIO.setup(self._number, GPIO.IN, self.GPIO_PULL_UPS[self._pull])
RuntimeError: Cannot determine SOC peripheral base address
Running the script from a directory where the user has write permission works but after exit the current working directory is cluttered with a name pipe:
pi@raspberrypi:/ $ cd ~
pi@raspberrypi:~ $ python3 gpiotest.py
pi@raspberrypi:~ $ ls -la .lgd*
prw-rw-r-- 1 pi pi 0 Jan 9 15:07 .lgd-nfy0
pi@raspberrypi:~ $
lgpio seems to have a lguSetWorkDir function and a LG_WD environment variable to configure the directory where it creates it's pipe(s) and it might be a good idea to set that to something safe like /tmp/gpiozero-PID/ that's guaranteed to be writable and not clash when running multiple scripts using gpiozero/lgpio in parallel - that seems to be the recommended solution until the underlying lgpio issue joan2937/lg#12 is resolved
The text was updated successfully, but these errors were encountered:
Operating system: RPiOS Bookwork lite 64bit
Python version: 3.11.2
Pi model: Pi 5
GPIO Zero version: 2.0
Pin factory used: default / lgpio
Trying to run a gpiozero script from a directory where the user doesn't have write permissions fails miserably as lgpio tries to create a named pipe in that directory. eg:
Then run this script eg as user
pi
from the root directoryRunning the script from a directory where the user has write permission works but after exit the current working directory is cluttered with a name pipe:
lgpio seems to have a
lguSetWorkDir
function and aLG_WD
environment variable to configure the directory where it creates it's pipe(s) and it might be a good idea to set that to something safe like/tmp/gpiozero-PID/
that's guaranteed to be writable and not clash when running multiple scripts using gpiozero/lgpio in parallel - that seems to be the recommended solution until the underlying lgpio issue joan2937/lg#12 is resolvedThe text was updated successfully, but these errors were encountered: