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

Exception if the from time is in the future #5

Closed
sphh opened this issue Aug 23, 2023 · 2 comments
Closed

Exception if the from time is in the future #5

sphh opened this issue Aug 23, 2023 · 2 comments

Comments

@sphh
Copy link

sphh commented Aug 23, 2023

I just installed balance (globally) and generated the following balance.conf file:

# Hours for the "work" tag
work {
  # Periodic configuration
  from 2023-10-01 {
    tue   8:00
    wed   8:00
    thu   3:30
  }
}

When running timew bal I get the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/dist-packages/timewarrior_balance/__main__.py", line 3, in <module>
    balance.main()
  File "/usr/local/lib/python3.10/dist-packages/timewarrior_balance/balance.py", line 126, in main
    widths = tuple(
  File "/usr/local/lib/python3.10/dist-packages/timewarrior_balance/balance.py", line 127, in <genexpr>
    max(len(header[i]), len(total_row[i]), *(len(r[i]) for r in rows))
TypeError: 'NoneType' object is not subscriptable
'/home/sphh/.timewarrior/extensions/balance' returned 1 without producing output.
@sphh sphh changed the title Exception if the `from1time Exception if the from time is in the future Aug 23, 2023
@guludo
Copy link
Owner

guludo commented Aug 23, 2023

@sphh, thanks for reporting this.

I think I was able to reproduce the bug here. It seems to happen when the report internal does not match any data or configuration entry.

For example, that would happen if you have a fresh timewarrior database and run timew bal today (2023-08-23) using the shared balance.conf, which has configuration defined for the future.

I have just pushed 674df30 as a fix for this. Does that fix the issue?

@sphh
Copy link
Author

sphh commented Aug 23, 2023

Yes, it is fixed.

Good investigation! Thanks for the quick fix!

@sphh sphh closed this as completed Aug 23, 2023
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

2 participants