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

jrnl crashing with utf-8 codec message on folder journal #1730

Closed
AymaneHrouch opened this issue Apr 29, 2023 · 2 comments
Closed

jrnl crashing with utf-8 codec message on folder journal #1730

AymaneHrouch opened this issue Apr 29, 2023 · 2 comments
Labels
support End user support

Comments

@AymaneHrouch
Copy link

AymaneHrouch commented Apr 29, 2023

Diagnostic output

jrnl: v4.0-beta2
Python: 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
OS: Linux 5.19.0-38-generic

Current Behavior

┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ UnicodeDecodeError ┃
┃ 'utf-8' codec can't decode byte 0xa0 in position 6038: invalid start byte ┃
┃ ┃
┃ This is probably a bug. Please file an issue at: ┃
https://github.com/jrnl-org/jrnl/issues/new/choose
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Expected Behavior

I'm not sur.

Repro Steps

This is my first time running jrnl and I got this error (After answering the initializing questions, path of journal, do i want to use colos, etc.)

Debug output

Output
[12:11:57] DEBUG    Logging start                                                                                                                                      main.py:32
           DEBUG    Parsed args:                                                                                                                                       main.py:42
                    Namespace(debug=True, preconfig_cmd=None, postconfig_cmd=None, filename=None, template=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, tagged=False, limit=None, excluded=[],                      
                    edit=False, delete=False, change_time=None, export=False, tags=False, short=False, config_override=[], config_file_path='', text=[],                         
                    exclude_starred=False, exclude_tagged=False)                                                                                                                 
           DEBUG    Reading configuration from file /home/aymane/.config/jrnl/jrnl.yaml                                                                             install.py:91
           DEBUG    Using configuration:                                                                                                                           install.py:117
                    "{                                                                                                                                                           
                        'colors': {                                                                                                                                              
                            'body': 'none',                                                                                                                                      
                            'date': 'black',                                                                                                                                     
                            'tags': 'yellow',                                                                                                                                    
                            'title': 'cyan'                                                                                                                                      
                        },                                                                                                                                                       
                        'default_hour': 9,                                                                                                                                       
                        'default_minute': 0,                                                                                                                                     
                        'editor': '',                                                                                                                                            
                        'encrypt': False,                                                                                                                                        
                        'highlight': True,                                                                                                                                       
                        'indent_character': '|',                                                                                                                                 
                        'journals': {'default': {'journal': '/home/aymane/Desktop'}},                                                                                            
                        'linewrap': 79,                                                                                                                                          
                        'tagsymbols': '#@',                                                                                                                                      
                        'template': False,                                                                                                                                       
                        'timeformat': '%F %r',                                                                                                                                   
                        'version': 'v4.0-beta2'                                                                                                                                  
                    }"                                                                                                                                                           
           DEBUG    Using journal name: default                                                                                                                     config.py:249
           DEBUG    Updating configuration with specific journal overrides:                                                                                         config.py:154
                    {'journal': '/home/aymane/Desktop'}                                                                                                                          
           DEBUG    Scoped config:                                                                                                                                  config.py:163
                    {                                                                                                                                                            
                        'colors': {                                                                                                                                              
                            'body': 'none',                                                                                                                                      
                            'date': 'black',                                                                                                                                     
                            'tags': 'yellow',                                                                                                                                    
                            'title': 'cyan'                                                                                                                                      
                        },                                                                                                                                                       
                        'default_hour': 9,                                                                                                                                       
                        'default_minute': 0,                                                                                                                                     
                        'editor': '',                                                                                                                                            
                        'encrypt': False,                                                                                                                                        
                        'highlight': True,                                                                                                                                       
                        'indent_character': '|',                                                                                                                                 
                        'journals': {'default': {'journal': '/home/aymane/Desktop'}},                                                                                            
                        'linewrap': 79,                                                                                                                                          
                        'tagsymbols': '#@',                                                                                                                                      
                        'template': False,                                                                                                                                       
                        'timeformat': '%F %r',                                                                                                                                   
                        'version': 'v4.0-beta2',                                                                                                                                 
                        'journal': '/home/aymane/Desktop'                                                                                                                        
                    }                                                                                                                                                            
           DEBUG    open_journal 'default'                                                                                                                         Journal.py:471
  File "/home/aymane/Desktop/code/python/jrnl/jrnl/main.py", line 44, in run
    status_code = controller.run(args)
  File "/home/aymane/Desktop/code/python/jrnl/jrnl/controller.py", line 70, in run
    journal = open_journal(args.journal_name, config)
  File "/home/aymane/Desktop/code/python/jrnl/jrnl/journals/Journal.py", line 497, in open_journal
    return Folder(journal_name, **config).open()
  File "/home/aymane/Desktop/code/python/jrnl/jrnl/journals/FolderJournal.py", line 41, in open
    journal = f.read()
  File "/usr/lib/python3.10/codecs.py", line 701, in read
    return self.reader.read(size)
  File "/usr/lib/python3.10/codecs.py", line 504, in read
    newchars, decodedbytes = self.decode(data, self.errors)
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/aymane/Desktop/code/python/jrnl/jrnl/main.py:44 in run                                     │
│                                                                                                  │
│   43 │   │                                                                                       │
│ ❱ 44 │   │   status_code = controller.run(args)                                                  │
│   45                                                                                             │
│                                                                                                  │
│ /home/aymane/Desktop/code/python/jrnl/jrnl/controller.py:70 in run                               │
│                                                                                                  │
│    69 │   # Get the journal we're going to be working with                                       │
│ ❱  70 │   journal = open_journal(args.journal_name, config)                                      │
│    71                                                                                            │
│                                                                                                  │
│ /home/aymane/Desktop/code/python/jrnl/jrnl/journals/Journal.py:497 in open_journal               │
│                                                                                                  │
│   496 │   │   │                                                                                  │
│ ❱ 497 │   │   │   return Folder(journal_name, **config).open()                                   │
│   498                                                                                            │
│                                                                                                  │
│ /home/aymane/Desktop/code/python/jrnl/jrnl/journals/FolderJournal.py:41 in open                  │
│                                                                                                  │
│    40 │   │   │   with codecs.open(filename, "r", "utf-8") as f:                                 │
│ ❱  41 │   │   │   │   journal = f.read()                                                         │
│    42 │   │   │   │   self.entries.extend(self._parse(journal))                                  │
│                                                                                                  │
│ /usr/lib/python3.10/codecs.py:701 in read                                                        │
│                                                                                                  │
│    700 │   │                                                                                     │
│ ❱  701 │   │   return self.reader.read(size)                                                     │
│    702                                                                                           │
│                                                                                                  │
│ /usr/lib/python3.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 0xa0 in position 6038: invalid start byte
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  UnicodeDecodeError                                                         ┃
┃  'utf-8' codec can't decode byte 0xa0 in position 6038: invalid start byte  ┃
┃                                                                             ┃
┃  This is probably a bug. Please file an issue at:                           ┃
┃  https://github.com/jrnl-org/jrnl/issues/new/choose                         ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Other Information

No response

@AymaneHrouch AymaneHrouch added 🆕 New! bug Something isn't working labels Apr 29, 2023
@AymaneHrouch
Copy link
Author

My bad I specified a folder instead of a text file

@micahellison micahellison added support End user support and removed bug Something isn't working 🆕 New! labels Apr 29, 2023
@micahellison
Copy link
Member

micahellison commented Apr 29, 2023

Thanks for documenting the solution here. We hope to prevent this error soon once we finish the solution to #1692.

@micahellison micahellison changed the title Bug Report jrnl crashing with utf-8 codec message on folder journal Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support End user support
Projects
None yet
Development

No branches or pull requests

2 participants