When using your library in a Python script embedded in a systemd service, I am hitting the following error on start up:
Oct 12 17:58:47 leaderbw pio[1674]: 2023-10-12 17:58:47 xCreatePipe: Can't set permissions (436) for //.lgd-nfy0, No such file or directory
... [omitted]...
Oct 12 17:58:47 leaderbw pio[1674]: import lgpio
Oct 12 17:58:47 leaderbw pio[1674]: File "/usr/lib/python3/dist-packages/lgpio.py", line 562, in <module>
Oct 12 17:58:47 leaderbw pio[1674]: _notify_thread = _callback_thread()
Oct 12 17:58:47 leaderbw pio[1674]: ^^^^^^^^^^^^^^^^^^
Oct 12 17:58:47 leaderbw pio[1674]: File "/usr/lib/python3/dist-packages/lgpio.py", line 504, in __init__
Oct 12 17:58:47 leaderbw pio[1674]: self._file = open('.lgd-nfy{}'.format(self._notify), 'rb')
Oct 12 17:58:47 leaderbw pio[1674]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 12 17:58:47 leaderbw pio[1674]: FileNotFoundError: [Errno 2] No such file or directory: '.lgd-nfy-3'
Looking into the Python code, the callback_thread tries to write the notify file to the current dir. Permissions errors can occur, like above. Does it make sense to write this file to /tmp (or tempdir()), since all users can write to it?
My solution is to modify the .service to set the working directory to somewhere I can write.
Preface: I'm still learning about your library
When using your library in a Python script embedded in a systemd service, I am hitting the following error on start up:
Looking into the Python code, the
callback_thread
tries to write the notify file to the current dir. Permissions errors can occur, like above. Does it make sense to write this file to/tmp
(ortempdir()
), since all users can write to it?My solution is to modify the
.service
to set the working directory to somewhere I can write.