-
Notifications
You must be signed in to change notification settings - Fork 431
Filters borked #2564
Copy link
Copy link
Open
Labels
issueSomething isn't workingSomething isn't working
Description
What happened?
Filter processing is currently broken:
https://github.com/AppDaemon/appdaemon/blob/dev/appdaemon/app_management.py#L846-L867
- variable run is unbound (https://github.com/AppDaemon/appdaemon/blob/dev/appdaemon/app_management.py#L860) -> introduce before line 852
- function utils.rreplace expects str, not PosixPath (https://github.com/AppDaemon/appdaemon/blob/dev/appdaemon/app_management.py#L865) -> cast variable file to string or replace utils.rrplace with PosixPath.with_suffix
eg:
def _process_filters(self):
for filter in self.AD.config.filters:
input_files = self.AD.app_dir.rglob(f"*{filter.input_ext}")
for file in input_files:
modified = file.stat().st_mtime
run = False
if file in self.filter_files:
if self.filter_files[file] < modified:
self.logger.info("Found modified filter file %s", file)
run = True
else:
self.logger.info("Found new filter file %s", file)
run = True
if run is True:
self.logger.info("Running filter on %s", file)
self.filter_files[file] = modified
# Run the filter
outfile = file.with_suffix(f".{filter.output_ext}")
command_line = filter.command_line.replace("$1", str(file))
command_line = command_line.replace("$2", str(outfile))
try:
subprocess.Popen(command_line, shell=True)Version
4.5.13
Installation type
Docker container
Relevant log output
2026-03-02 12:11:23.688363 INFO AppDaemon: Found new filter file /mnt/apps/test.py
2026-03-02 12:11:23.688814 INFO AppDaemon: Running filter on /mnt/apps/test.py
2026-03-02 12:11:23.697427 ERROR AppDaemon: Utility loop encountered an error
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/appdaemon/utility_loop.py", line 189, in loop
await self._init_loop()
File "/usr/local/lib/python3.12/site-packages/appdaemon/utility_loop.py", line 172, in _init_loop
await self.AD.app_management.start()
File "/usr/local/lib/python3.12/site-packages/appdaemon/app_management.py", line 176, in start
await self.check_app_updates(mode=UpdateMode.INIT)
File "/usr/local/lib/python3.12/site-packages/appdaemon/app_management.py", line 874, in check_app_updates
await self._process_filters()
File "/usr/local/lib/python3.12/site-packages/appdaemon/utils.py", line 673, in wrapper
return await run_in_executor(self, func, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/appdaemon/utils.py", line 698, in run_in_executor
return await future
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/appdaemon/app_management.py", line 790, in _process_filters
outfile = utils.rreplace(file, filter.input_ext, filter.output_ext, 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/appdaemon/utils.py", line 560, in rreplace
li = s.rsplit(old, occurrence)
^^^^^^^^
AttributeError: 'PosixPath' object has no attribute 'rsplit'Relevant code in the app or config file that caused the issue
Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
issueSomething isn't workingSomething isn't working