jrnl-org / jrnl

Collect your thoughts and notes without leaving the command line.
https://jrnl.sh
GNU General Public License v3.0
6.48k stars 523 forks source link

Error: 'str' object cannot be interpreted as an integer #1911

Open prabindm opened 2 months ago

prabindm commented 2 months ago

Diagnostic output

jrnl: v4.1
Python: 3.12.5 (main, Aug  6 2024, 19:08:49) [Clang 15.0.0 (clang-1500.3.9.4)]
OS: Darwin 23.6.0

Current Behavior

This input is generating an error:

jrnl today: updated R 
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  TypeError                                           ┃
┃  'str' object cannot be interpreted as an integer    ┃
┃                                                      ┃
┃  This is probably a bug. Please file an issue at:    ┃
┃  https://github.com/jrnl-org/jrnl/issues/new/choose  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Expected Behavior

jrnl should accept today/yesterday as time points.

Repro Steps

write: jrnl today: updated R

Debug output

``` File "/opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/main.py", line 44, in run status_code = controller.run(args) ^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/controller.py", line 79, in run append_mode(**kwargs) File "/opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/controller.py", line 168, in append_mode journal.new_entry(raw) File "/opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/journals/Journal.py", line 360, in new_entry date = time.parse( ^^^^^^^^^^^ File "/opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/time.py", line 80, in parse date = datetime.datetime( # Use the default time ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ /opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/main.py:44 in run │ │ │ │ 43 │ │ │ │ ❱ 44 │ │ status_code = controller.run(args) │ │ 45 │ │ │ │ /opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/controller.py:79 in run │ │ │ │ 78 │ if _is_append_mode(**kwargs): │ │ ❱ 79 │ │ append_mode(**kwargs) │ │ 80 │ │ return │ │ │ │ /opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/controller.py:168 in │ │ append_mode │ │ │ │ 167 │ ) │ │ ❱ 168 │ journal.new_entry(raw) │ │ 169 │ if args.journal_name != DEFAULT_JOURNAL_KEY: │ │ │ │ /opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/journals/Journal.py:360 │ │ in new_entry │ │ │ │ 359 │ │ │ if colon_pos > 0: │ │ ❱ 360 │ │ │ │ date = time.parse( │ │ 361 │ │ │ │ │ raw[:colon_pos], │ │ │ │ /opt/homebrew/Cellar/jrnl/4.1/libexec/lib/python3.12/site-packages/jrnl/time.py:80 in parse │ │ │ │ 79 │ if hasDate and not hasTime: │ │ ❱ 80 │ │ date = datetime.datetime( # Use the default time │ │ 81 │ │ │ *date[:3], │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ TypeError: 'str' object cannot be interpreted as an integer ┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ TypeError ┃ ┃ 'str' object cannot be interpreted as an integer ┃ ┃ ┃ ┃ This is probably a bug. Please file an issue at: ┃ ┃ https://github.com/jrnl-org/jrnl/issues/new/choose ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ```

Other Information

No response

micahellison commented 2 months ago

Thanks for filing this issue, @prabindm.

So far, we haven't been able to reproduce this issue, whether installed via pipx or brew or on Mac, Windows, or Linux.

To help us narrow it down, could you try rerunning this with --debug and paste the whole output here? Like so:

jrnl today: updated R --debug