thp / urlwatch

Watch (parts of) webpages and get notified when something changes via e-mail, on your phone or via other means. Highly configurable.
https://thp.io/2008/urlwatch/
Other
2.79k stars 350 forks source link

urlwatch 2.25 - AttributeError: 'list' object has no attribute 'read' #815

Closed jpiszcz closed 2 months ago

jpiszcz commented 2 months ago

This error only happened once and when I re-run urlwatch, I cannot reproduce this issue. Is there a way to determine which job is causing this error if it happens again?

Traceback (most recent call last):
  File "/usr/bin/urlwatch", line 33, in <module>
    sys.exit(load_entry_point('urlwatch==2.25', 'console_scripts', 'urlwatch')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urlwatch/cli.py", line 112, in main
    urlwatch_command.run()
  File "/usr/lib/python3/dist-packages/urlwatch/command.py", line 433, in run
    self.urlwatcher.close()
  File "/usr/lib/python3/dist-packages/urlwatch/main.py", line 97, in close
    self.report.finish()
  File "/usr/lib/python3/dist-packages/urlwatch/handler.py", line 217, in finish
    ReporterBase.submit_all(self, self.job_states, duration)
  File "/usr/lib/python3/dist-packages/urlwatch/reporters.py", line 136, in submit_all
    subclass(report, cfg, job_states, duration).submit()
  File "/usr/lib/python3/dist-packages/urlwatch/reporters.py", line 362, in submit
    body = '\n'.join(super().submit())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urlwatch/reporters.py", line 268, in submit
    summary_part, details_part = self._format_output(job_state, line_length)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urlwatch/reporters.py", line 310, in _format_output
    content = self._format_content(job_state)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urlwatch/reporters.py", line 297, in _format_content
    return job_state.get_diff()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urlwatch/handler.py", line 145, in get_diff
    self._generated_diff = self._generate_diff()
                           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/urlwatch/handler.py", line 160, in _generate_diff
    cmdline = shlex.split(self.job.diff_tool) + [old_file_path, new_file_path]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/shlex.py", line 315, in split
    return list(lex)
           ^^^^^^^^^
  File "/usr/lib/python3.11/shlex.py", line 300, in __next__
    token = self.get_token()
            ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/shlex.py", line 109, in get_token
    raw = self.read_token()
          ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/shlex.py", line 140, in read_token
    nextchar = self.instream.read(1)
               ^^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'read'
thp commented 2 months ago

It seems like you have configured the diff_tool of a job to something that's more like a list instead of a string.

jpiszcz commented 2 months ago

Thanks, fixed- had an incorrect diff_tool: in one of my rules.