Skip to content

Don't check reporters are enabled if they aren't run#870

Merged
thp merged 1 commit into
thp:masterfrom
Jamstah:error-when-not-reporting
Jul 9, 2026
Merged

Don't check reporters are enabled if they aren't run#870
thp merged 1 commit into
thp:masterfrom
Jamstah:error-when-not-reporting

Conversation

@Jamstah

@Jamstah Jamstah commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

#822 introduced a bug - running a command that doesn't run reporters (like --list) now fails because it tries to check if the reporters were run can't because the dynamic attribute is only set during the reporter runs.

This PR moves the check to behind where the reporters are called. Interestingly, when one reporter is selected that was already the behaviour.

(venv) jammy@mac007470 urlwatch % ./urlwatch --config lib/urlwatch/tests/data/urlwatch.yaml --urls lib/urlwatch/tests/data/jobs-with-tags.yaml --list
1: UTC ( date -u )
2: RFC ( date -R )
3: Local ( date )
4: Static ( echo hi )
Traceback (most recent call last):
  File "/Users/jammy/workspaces/urlwatch/lib/urlwatch/command.py", line 497, in run
    self.handle_actions()
  File "/Users/jammy/workspaces/urlwatch/lib/urlwatch/command.py", line 295, in handle_actions
    sys.exit(self.list_urls())
SystemExit: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jammy/workspaces/urlwatch/./urlwatch", line 17, in <module>
    cli.main()
  File "/Users/jammy/workspaces/urlwatch/lib/urlwatch/cli.py", line 109, in main
    urlwatch_command.run()
  File "/Users/jammy/workspaces/urlwatch/lib/urlwatch/command.py", line 500, in run
    self.urlwatcher.close()
  File "/Users/jammy/workspaces/urlwatch/lib/urlwatch/main.py", line 113, in close
    if not self.report.reporters_enabled:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Report' object has no attribute 'reporters_enabled'

@thp thp left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix!

@thp
thp merged commit a523390 into thp:master Jul 9, 2026
5 checks passed
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.

2 participants