Diagnostic output
jrnl: v3.3
Python: 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]
OS: Linux 5.15.80-1-lts
Current Behavior
The following command produces an exception:
$ jrnl -1 --edit --change-time @tag
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ TypeError ┃
┃ '<' not supported between instances of 'datetime.datetime' and 'NoneType' ┃
┃ ┃
┃ This is probably a bug. Please file an issue at: ┃
┃ https://github.com/jrnl-org/jrnl/issues/new/choose ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Expected Behavior
jrnl should open the most recent entry with @tag
for editing, changing the time to the current time. That is to say, it should do the same as this command (which has the same arguments in a different order):
jrnl -1 @pomodoros --edit --change-time
Else, if that's complicated by looking for an optional argument to --change-time
, it should produce a user-accessible error message.
Repro Steps
Running
jrnl -1 --edit --change-time @tag
(See "Current Behavior" above)
Debug output
$ jrnl -1 --edit --change-time @tag --debug
DEBUG root Parsed args: Namespace(debug=True, preconfig_cmd=None, postconfig_cmd=None, filename=None, on_date=None, today_in_history=False, month=None, day=None, year=None, start_date=None, end_date=None, contains=None, strict=False, starred=False, limit=1, excluded=[], edit=True, delete=False, change_time='@tag', export=False, tags=False, short=False, config_override=[], config_file_path='', text=[])
DEBUG root Reading configuration from file /home/redacted/.config/jrnl/jrnl.yaml
DEBUG root Using configuration "{'colors': {'body': 'none', 'date': 'none', 'tags': 'none', 'title': 'none'}, 'default_hour': 17, 'default_minute': 5, 'editor': 'emacs -nw', 'encrypt': False, 'highlight': True, 'indent_character': '|', 'journals': {'default': '/home/redacted/journal.txt', 'more_redacted_journals': 'redacted'}, 'linewrap': 200, 'tagsymbols': '@', 'template': False, 'timeformat': '%Y-%m-%d %H:%M', 'version': 'v2.7'}"
DEBUG root Using journal name: default
DEBUG root opened PlainJournal with 89 entries
File "/usr/lib/python3.10/site-packages/jrnl/cli.py", line 39, in cli
status_code = run(args)
File "/usr/lib/python3.10/site-packages/jrnl/jrnl.py", line 72, in run
search_mode(**kwargs)
File "/usr/lib/python3.10/site-packages/jrnl/jrnl.py", line 191, in search_mode
_change_time_search_results(no_prompt=no_change_time_prompt, **kwargs)
File "/usr/lib/python3.10/site-packages/jrnl/jrnl.py", line 431, in _change_time_search_results
journal.sort()
File "/usr/lib/python3.10/site-packages/jrnl/Journal.py", line 194, in sort
self.entries = sorted(self.entries, key=lambda entry: entry.date)
╭────────────────────────────── Traceback (most recent call last) ──────────────────────────────╮
│ /usr/lib/python3.10/site-packages/jrnl/cli.py:39 in cli │
│ │
│ 38 │ │ │
│ ❱ 39 │ │ status_code = run(args) │
│ 40 │
│ │
│ /usr/lib/python3.10/site-packages/jrnl/jrnl.py:72 in run │
│ │
│ 71 │ else: │
│ ❱ 72 │ │ search_mode(**kwargs) │
│ 73 │
│ │
│ /usr/lib/python3.10/site-packages/jrnl/jrnl.py:191 in search_mode │
│ │
│ 190 │ │ │ no_change_time_prompt = len(journal.entries) == 1 │
│ ❱ 191 │ │ │ _change_time_search_results(no_prompt=no_change_time_prompt, **kwargs) │
│ 192 │
│ │
│ /usr/lib/python3.10/site-packages/jrnl/jrnl.py:431 in _change_time_search_results │
│ │
│ 430 │ │ journal.entries += other_entries │
│ ❱ 431 │ │ journal.sort() │
│ 432 │ │ journal.write() │
│ │
│ /usr/lib/python3.10/site-packages/jrnl/Journal.py:194 in sort │
│ │
│ 193 │ │ """Sorts the Journal's entries by date""" │
│ ❱ 194 │ │ self.entries = sorted(self.entries, key=lambda entry: entry.date) │
│ 195 │
╰───────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: '<' not supported between instances of 'datetime.datetime' and 'NoneType'
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ TypeError ┃
┃ '<' not supported between instances of 'datetime.datetime' and 'NoneType' ┃
┃ ┃
┃ This is probably a bug. Please file an issue at: ┃
┃ https://github.com/jrnl-org/jrnl/issues/new/choose ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Other Information
No response
bug :pushpin: ready for pr