Skip to content

Conversation

@cebtenzzre
Copy link
Contributor

If a NameError or ImportError is thrown inside of appdaemon, the relative_to will fail like this:

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/appdaemon/utility_loop.py", line 246, in _loop_iteration_context
    yield timing
  File "/usr/lib/python3.12/site-packages/appdaemon/utility_loop.py", line 197, in loop
    await self.AD.app_management.check_app_updates()
  File "/usr/lib/python3.12/site-packages/appdaemon/app_management.py", line 930, in check_app_updates
    await self._create_and_start_apps(update_actions)
  File "/usr/lib/python3.12/site-packages/appdaemon/app_management.py", line 1222, in _create_and_start_apps
    await safe_start(self)
  File "/usr/lib/python3.12/site-packages/appdaemon/exceptions.py", line 182, in wrapper
    user_exception_block(logger, e, app_dir, header)
  File "/usr/lib/python3.12/site-packages/appdaemon/exceptions.py", line 116, in user_exception_block
    file = Path(frame.filename).relative_to(app_dir.parent)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/pathlib.py", line 682, in relative_to
    raise ValueError(f"{str(self)!r} is not in the subpath of {str(other)!r}")

This change causes that text to only be appended for exceptions thrown in user app code.

Related to #2457

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant