jrnl icon indicating copy to clipboard operation
jrnl copied to clipboard

UnicodeDecodeError

Open flocentblack opened this issue 2 years ago • 0 comments

UnicodeDecodeError ┃ 'utf-8' codec can't decode byte 0x95 in position 351: invalid start byte

Environment

jrnl --diagnostic jrnl: v3.0 Python: 3.10.5 (main, Jun 6 2022, 12:05:50) [GCC 5.4.0 20160609] OS: Linux 4.19.0-18-amd64

  • Install method: Brew

Current Behavior

UnicodeDecodeError ┃ 'utf-8' codec can't decode byte 0x95 in position 351: invalid start byte

This occurred when attempting to run jrnl for the first time.

flocentblack avatar Aug 03 '22 22:08 flocentblack

Hi @flocentblack, thanks for reporting this. Are you still running into this issue, and if so, could you please run jrnl --debug and paste the entire output here?

micahellison avatar Aug 13 '22 19:08 micahellison

I just tried to reproduce this on my machine (Windows with WSL/Ubuntu) and couldn't repro the issue. I used brew to uninstall and reinstall jrnl and I deleted my jrnl config file beforehand.

jrnl --diagnostic output:

jrnl: v3.0
Python: 3.10.6 (main, Aug  1 2022, 20:38:21) [GCC 5.4.0 20160609]
OS: Linux 4.4.0-19041-Microsoft

micahellison avatar Aug 13 '22 20:08 micahellison

Thanks Micah for responding. When I attempted to run this today, jrnl was an invalid command. Ran the homebrew scripts and attempted to re-install jrnl. jrnl was already installed, but now is no longer an invalid command. Here is the debug output:

$ jrnl --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=None, excluded=[], edit=False, delete=False, change_time=None, export=False, tags=False, short=False, config_override=[], config_file_path='', text=[])
DEBUG    root         Reading configuration from file /home/supereb/.config/jrnl/jrnl.yaml
DEBUG    root         Using configuration "{'colors': {'body': 'none', 'date': 'none', 'tags': 'none', 'title': 'none'}, 'default_hour': 9, 'default_minute': 0, 'editor': '', 'encrypt': False, 'highlight': True, 'indent_character': '|', 'journals': {'default': '/home/abcdefg'}, 'linewrap': 79, 'tagsymbols': '#@', 'template': False, 'timeformat': '%Y-%m-%d %H:%M', 'version': 'v3.0'}"
DEBUG    root         Using journal name: default
  File "/home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/cli.py", line 39, in cli
    status_code = run(args)
  File "/home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/jrnl.py", line 60, in run
    journal = open_journal(args.journal_name, config)
  File "/home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/Journal.py", line 457, in open_journal
    return FolderJournal.Folder(journal_name, **config).open()
  File "/home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/FolderJournal.py", line 36, in open
    journal = f.read()
  File "/home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/bin/../../../../../opt/[email protected]/lib/python3.10/codecs.py", line 701, in read
    return self.reader.read(size)
  File "/home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/bin/../../../../../opt/[email protected]/lib/python3.10/codecs.py", line 504, in read
    newchars, decodedbytes = self.decode(data, self.errors)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/cli.py:39   │
│ in cli                                                                                           │
│                                                                                                  │
│   38 │   │                                                                                       │
│ ❱ 39 │   │   status_code = run(args)                                                             │
│   40                                                                                             │
│                                                                                                  │
│ /home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/jrnl.py:60  │
│ in run                                                                                           │
│                                                                                                  │
│    59 │   # Get the journal we're going to be working with                                       │
│ ❱  60 │   journal = open_journal(args.journal_name, config)                                      │
│    61                                                                                            │
│                                                                                                  │
│ /home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/Journal.py: │
│ 457 in open_journal                                                                              │
│                                                                                                  │
│   456 │   │   │                                                                                  │
│ ❱ 457 │   │   │   return FolderJournal.Folder(journal_name, **config).open()                     │
│   458                                                                                            │
│                                                                                                  │
│ /home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/lib/python3.10/site-packages/jrnl/FolderJourn │
│ al.py:36 in open                                                                                 │
│                                                                                                  │
│    35 │   │   │   with codecs.open(filename, "r", "utf-8") as f:                                 │
│ ❱  36 │   │   │   │   journal = f.read()                                                         │
│    37 │   │   │   │   self.entries.extend(self._parse(journal))                                  │
│                                                                                                  │
│ /home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/bin/../../../../../opt/[email protected]/lib/python │
│ 3.10/codecs.py:701 in read                                                                       │
│                                                                                                  │
│    700 │   │                                                                                     │
│ ❱  701 │   │   return self.reader.read(size)                                                     │
│    702                                                                                           │
│                                                                                                  │
│ /home/linuxbrew/.linuxbrew/Cellar/jrnl/3.0/libexec/bin/../../../../../opt/[email protected]/lib/python │
│ 3.10/codecs.py:504 in read                                                                       │
│                                                                                                  │
│    503 │   │   │   try:                                                                          │
│ ❱  504 │   │   │   │   newchars, decodedbytes = self.decode(data, self.errors)                   │
│    505 │   │   │   except UnicodeDecodeError as exc:                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x95 in position 351: invalid start byte
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  UnicodeDecodeError                                                        ┃
┃  'utf-8' codec can't decode byte 0x95 in position 351: invalid start byte  ┃
┃                                                                            ┃
┃  This is probably a bug. Please file an issue at:                          ┃
┃  https://github.com/jrnl-org/jrnl/issues/new/choose                        ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

flocentblack avatar Aug 15 '22 16:08 flocentblack

Just discovered that closing the terminal, opening a new terminal window and attempting to run jrnl will give the command not found message

flocentblack avatar Aug 15 '22 16:08 flocentblack

Hi @flocentblack, I'm not sure what's going on. It looks like it could be specific to linuxbrew and/or your linux installation. Have you checked with the brew community? They might have a better understanding of this issue. Alternatively, you might have better luck using pipx to install jrnl instead of brew.

We have seen this UnicodeDecodeError before, but only in Windows with older Python installations. It makes me wonder if perhaps your terminal doesn't support unicode. Otherwise, I'm not sure what would lead to this issue.

micahellison avatar Aug 21 '22 19:08 micahellison

I'm closing this for now, but feel free update this issue with more info if you find anything new.

micahellison avatar Sep 03 '22 18:09 micahellison