Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovos-logs TypeError in log_parser.py ~372 #261

Open
mcnamamj opened this issue Jul 18, 2024 · 0 comments
Open

ovos-logs TypeError in log_parser.py ~372 #261

mcnamamj opened this issue Jul 18, 2024 · 0 comments

Comments

@mcnamamj
Copy link

Installed a fresh install last night using ovos-installer on a Raspberry Pi 4 (Mark II).

Using ovos-logs slice, I would get this error:

  File "/home/matt/.venvs/ovos/lib/python3.11/site-packages/ovos_utils/log_parser.py", line 372, in slice
    if start <= log.timestamp < end:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '<=' not supported between instances of 'datetime.datetime' and 'str'

if start <= log.timestamp < end:

So it seemed like log.timestamp wasn't a datetime.datetime.

I added debug info to identify problematic line(s):

        for log in OVOSLogParser.parse_file(logfile):
            if log.timestamp == "":
                console.print(f"\n\nOut:{log}\n\n")
                continue
            if start <= log.timestamp < end:

When I ran ovos-logs slice next, before the logs showed I did find the debug line ran for 1 log entry:

Out:2024-07-17 21:59:57.530 - common_query.openvoiceos - INFO - First run of common_query.openvoiceos

NOTE: The prefix OUT: comes from my console.print.

So it just seems there's something wrong about this one line that ovos-logs couldn't handle.

That patch fixed it for me, but I'm:

  1. Not sure what's wrong with this line
  2. Unfamiliar with best practices on how to address this

I'm happy to make a PR if I get some feedback on how to address it.

Thanks y'all!

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

No branches or pull requests

1 participant