I am certainly no believer in AI so please treat this with all due 
caution...

I was intrigued to know what 'ldg-nfy0' was so I Googled it. The AI summary 
provided:

```
.lgd-nfy0 is a temporary named pipe file created by the lgpio Python 
library, which is commonly used on Raspberry Pi devices for managing 
hardware pins. The file acts as a notification channel for handling 
hardware events and interrupts. [1 
<https://community.openhab.org/t/python3-binding-discussion/161914/143>, 2 
<https://forum.openmarine.net/showthread.php?tid=6149&page=2>]
When scripts utilizing high-level libraries like gpiozero crash or report 
an "Operation not permitted" or "Can't set permissions" error, it is almost 
always due to this file being generated in a directory where your program 
does not have write permissions. [1 
<https://github.com/gpiozero/gpiozero/issues/1106>, 2 
<https://forums.raspberrypi.com/viewtopic.php?t=379869>]
Why the Error Happens

   - Systemd Services: Running your script as a boot service defaults the 
   working directory to the root directory (/), where standard scripts are 
   forbidden to write. [1 
   <https://github.com/gpiozero/gpiozero/discussions/1153>]
   - External Storage: Running scripts directly from a USB flash drive or 
   restricted media directory often conflicts with Linux file permission 
   policies. [1 <https://forums.raspberrypi.com/viewtopic.php?t=399250>, 2 
   <https://forums.raspberrypi.com/viewtopic.php?t=379869>]

How to Fix It
You can easily resolve this issue using one of the following proven methods:
Method 1: Change the Working Directory Environment Variable (Recommended) [1 
<https://github.com/joan2937/lg/issues/12>]
You can force lgpio to create its temporary notification pipes in the 
system's global temporary folder (/tmp), where all users have write 
permissions. [1 <https://github.com/joan2937/lg/issues/22>, 2 
<https://forum.openmarine.net/showthread.php?tid=6149&page=2>]

   1. Open your terminal.
   2. Define the global environment variable by running:
   bash
   export LG_WD=/tmp 
   Use code with caution.
   3. To make this change permanent, add export LG_WD=/tmp to your system 
   profile or your shell configuration file (like ~/.bashrc). [1 
   <https://forum.openmarine.net/showthread.php?tid=6149&page=2>]

Method 2: Fix the Systemd Service File
If your script crashes specifically when executed via a systemd service, 
you must explicitly declare a writable directory. [1 
<https://github.com/gpiozero/gpiozero/discussions/1153>]

   1. Open your service configuration file (e.g., 
   /etc/systemd/system/myscript.service).
   2. Add a WorkingDirectory parameter under the [Service] block pointing 
   to a path owned by your script's user:
   ini
   [Service] WorkingDirectory=/home/your_username/ 
   ExecStart=/usr/bin/python3 /home/your_username/script.py 
   Use code with caution.
   3. Reload the system daemon and restart your service:
   bash
   sudo systemctl daemon-reload sudo systemctl restart myscript.service 
   Use code with caution.
   [1 <https://github.com/gpiozero/gpiozero/discussions/1153>]

Method 3: Change Directory Inside the Python Script
If you do not want to change system files, you can force the Python runtime 
to change its execution context to a writable folder before invoking any 
hardware controls. Add these lines to the absolute top of your script: [1 
<https://github.com/gpiozero/gpiozero/discussions/1153>]
python
import os os.chdir('/tmp') # Safely redirects pipe generation to the 
temporary folder from gpiozero import LED # Or any other hardware libraries 
Use code with caution.
```

On Sunday, 5 July 2026 at 9:55:55 pm UTC+10 Christian Peters wrote:

> Hi,
>
> I just ran into the same problem: rpi model B, 32 bit Debian Trixie, weewx 
> latest, as3935.py. 
>
> Not sure howto fix it...!?
> Installed with apt, no venv.
> Any help would be great. 
>
> Regards,
> Christian 
>  
>
>
> INFO weewx.engine: Loading station type Simulator (weewx.drivers.simulator)
> 2026-07-05T11:31:26.452462+02:00 webpi weewxd[1283]: 2026-07-05 11:31:26 
> xCreatePipe: Can't set permissions (436) for //.lgd-nfy0, No such file or 
> directory
> 2026-07-05T11:31:26.459798+02:00 webpi weewxd[1283]: CRITICAL __main__: 
> Caught OSError: [Errno 2] No such file or directory: '.lgd-nfy-3'
> 2026-07-05T11:31:26.515718+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****  Traceback (most recent call last):
> 2026-07-05T11:31:26.530273+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/share/weewx/weewxd.py", line 121, in main
> 2026-07-05T11:31:26.531269+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      engine = weewx.engine.StdEngine(config_dict)
> 2026-07-05T11:31:26.532277+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/share/weewx/weewx/engine.py", line 89, in __init__
> 2026-07-05T11:31:26.533171+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      self.loadServices(config_dict)
> 2026-07-05T11:31:26.534056+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
> 2026-07-05T11:31:26.534935+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/share/weewx/weewx/engine.py", line 157, in loadServices
> 2026-07-05T11:31:26.540367+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      obj = weeutil.weeutil.get_object(svc)(self, config_dict)
> 2026-07-05T11:31:26.541467+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****            ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
> 2026-07-05T11:31:26.542358+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/share/weewx/weeutil/weeutil.py", line 1405, in 
> get_object
> 2026-07-05T11:31:26.543236+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      module = importlib.import_module(module_name)
> 2026-07-05T11:31:26.549302+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/lib/python3.13/importlib/__init__.py", line 88, in 
> import_module
> 2026-07-05T11:31:26.560050+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      return _bootstrap._gcd_import(name[level:], package, level)
> 2026-07-05T11:31:26.561043+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****             ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2026-07-05T11:31:26.562020+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
> 2026-07-05T11:31:26.562909+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
> 2026-07-05T11:31:26.563908+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "<frozen importlib._bootstrap>", line 1331, in 
> _find_and_load_unlocked
> 2026-07-05T11:31:26.564802+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
> 2026-07-05T11:31:26.570396+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "<frozen importlib._bootstrap_external>", line 1026, in 
> exec_module
> 2026-07-05T11:31:26.580942+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "<frozen importlib._bootstrap>", line 488, in 
> _call_with_frames_removed
> 2026-07-05T11:31:26.584793+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/etc/weewx/bin/user/as3935.py", line 74, in <module>
> 2026-07-05T11:31:26.587229+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      import RPi.GPIO as GPIO
> 2026-07-05T11:31:26.591976+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 
> 14, in <module>
> 2026-07-05T11:31:26.600240+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      import lgpio
> 2026-07-05T11:31:26.602930+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/lib/python3/dist-packages/lgpio.py", line 563, in 
> <module>
> 2026-07-05T11:31:26.607009+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      _notify_thread = _callback_thread()
> 2026-07-05T11:31:26.612416+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****    File "/usr/lib/python3/dist-packages/lgpio.py", line 504, in 
> __init__
> 2026-07-05T11:31:26.615416+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****      self._file = open('.lgd-nfy{}'.format(self._notify), 'rb')
> 2026-07-05T11:31:26.621176+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 2026-07-05T11:31:26.623563+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****  FileNotFoundError: [Errno 2] No such file or directory: '.lgd-nfy-3'
> 2026-07-05T11:31:26.624494+02:00 webpi weewxd[1283]: CRITICAL __main__:   
>   ****  Waiting 10 seconds then retrying...
>
> David Enstrom schrieb am Sonntag, 12. Oktober 2025 um 14:36:51 UTC+2:
>
>> Clarification: currently running WeeWX V5.0.2 
>> So something has changed to cause this error: either the OS to Trixie or 
>> WeeWX to V5.1.0
>>
>> On Friday, October 10, 2025 at 1:16:45 AM UTC-4 Graham Eddy wrote:
>>
>>> i upgraded bookworm to trixie with no such issues. it is specific to 
>>> this installation. i think the clue is all in the error message:
>>>
>>> **** FileNotFoundError: [Errno 2] No such file or directory: '.lgd-nfy-3'
>>>
>>> *⊣GE⊢*
>>>
>>> On 10 Oct 2025, at 1:37 pm, David Enstrom <[email protected]> wrote:
>>>
>>> I was previously running WeeWX V5 with no issues ... really the only 
>>> change was the OS, to Trixie.
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/05f5f911-e3c0-405f-a550-59a3ed656ed5n%40googlegroups.com.

Reply via email to