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

Update from 4.0.1_4 to 4.0.1_5 broke something with colors #1819

Closed
h0adp0re opened this issue Oct 30, 2023 · 3 comments · Fixed by #1821
Closed

Update from 4.0.1_4 to 4.0.1_5 broke something with colors #1819

h0adp0re opened this issue Oct 30, 2023 · 3 comments · Fixed by #1821
Labels
bug Something isn't working

Comments

@h0adp0re
Copy link

h0adp0re commented Oct 30, 2023

Diagnostic output

jrnl: v4.0.1
Python: 3.12.0 (main, Oct  2 2023, 12:03:24) [Clang 15.0.0 (clang-1500.0.40.1)]
OS: Darwin 23.1.0

Current Behavior

The output of jrnl --format pretty doesn't preserve color information when written into a Bash variable. This used to be the case before updating from 4.0.1_4 to 4.0.1_5.

Expected Behavior

The output of jrnl --format pretty preserves color information when written into a Bash variable.

Repro Steps

jrnl_log="$(jrnl -1 --format pretty)"
echo "$jrnl_log"

Debug output

[12:13:48] 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=1, excluded=[], edit=False, delete=False, change_time=None,               
                    export='pretty', tags=False, short=False, config_override=[], config_file_path='', text=[],                                
                    exclude_starred=False, exclude_tagged=False)                                                                               
           DEBUG    Reading configuration from file $XDG_CONFIG_HOME/jrnl/jrnl.yaml                                     install.py:91
           DEBUG    Using configuration:                                                                                         install.py:117
                    "{                                                                                                                         
                        'colors': {                                                                                                            
                            'body': 'none',                                                                                                    
                            'date': 'none',                                                                                                    
                            'tags': 'cyan',                                                                                                    
                            'title': 'yellow'                                                                                                  
                        },                                                                                                                     
                        'default_hour': 10,                                                                                                    
                        'default_minute': 0,                                                                                                   
                        'display_format': 'pretty',                                                                                            
                        'editor': 'nvim',                                                                                                      
                        'encrypt': False,                                                                                                      
                        'highlight': True,                                                                                                     
                        'indent_character': '|',                                                                                               
                        'journals': {                                                                                                          
                            'default': {'journal': '$XDG_DATA_HOME/jrnl/journal.txt'},                                                         
                            'tomorrow': {'journal': '$XDG_DATA_HOME/jrnl/tomorrow.txt'}                                                        
                        },                                                                                                                     
                        'linewrap': 79,                                                                                                        
                        'tagsymbols': '#@',                                                                                                    
                        'template': False,                                                                                                     
                        'timeformat': '%F %R',                                                                                                 
                        'version': 'v4.0.1'                                                                                                    
                    }"                                                                                                                         
           DEBUG    Using journal name: default                                                                                   config.py:205
           DEBUG    Updating configuration with specific journal overrides:                                                       config.py:110
                    {'journal': '$XDG_DATA_HOME/jrnl/journal.txt'}                                                                             
           DEBUG    Scoped config:                                                                                                config.py:119
                    {                                                                                                                          
                        'colors': {                                                                                                            
                            'body': 'none',                                                                                                    
                            'date': 'none',                                                                                                    
                            'tags': 'cyan',                                                                                                    
                            'title': 'yellow'                                                                                                  
                        },                                                                                                                     
                        'default_hour': 10,                                                                                                    
                        'default_minute': 0,                                                                                                   
                        'display_format': 'pretty',                                                                                            
                        'editor': 'nvim',                                                                                                      
                        'encrypt': False,                                                                                                      
                        'highlight': True,                                                                                                     
                        'indent_character': '|',                                                                                               
                        'journals': {                                                                                                          
                            'default': {'journal': '$XDG_DATA_HOME/jrnl/journal.txt'},                                                         
                            'tomorrow': {'journal': '$XDG_DATA_HOME/jrnl/tomorrow.txt'}                                                        
                        },                                                                                                                     
                        'linewrap': 79,                                                                                                        
                        'tagsymbols': '#@',                                                                                                    
                        'template': False,                                                                                                     
                        'timeformat': '%F %R',                                                                                                 
                        'version': 'v4.0.1',                                                                                                   
                        'journal': '$XDG_DATA_HOME/jrnl/journal.txt'                                                                           
                    }                                                                                                                          
           DEBUG    open_journal 'default'                                                                                       Journal.py:471
           DEBUG    start                                                                                                  BaseEncryption.py:16
           DEBUG    start                                                                                                    NoEncryption.py:12
           DEBUG    decrypting                                                                                             BaseEncryption.py:29
           DEBUG    decrypting                                                                                               NoEncryption.py:19
           DEBUG    opened Journal with 382 entries                                                                              Journal.py:136
           DEBUG    Search mode: starting                                                                                     controller.py:201
           DEBUG    Search mode: has search args                                                                              controller.py:208
           DEBUG    count: 1                                                                                                  controller.py:251
           DEBUG    args.limit is true-ish                                                                                    controller.py:262
2023-10-30 10:00 Testing jrnl output.

Other Information

No response

@h0adp0re h0adp0re added 🆕 New! bug Something isn't working labels Oct 30, 2023
@micahellison
Copy link
Member

Hi @h0adp0re, thanks for reporting this, and for all the detailed info. I'm able to reproduce this with linuxbrew in my WSL/Ubuntu bash environment on v4.0.1_5. Just as you wrote, it outputs color to the terminal, but the color isn't saved in variables.

At first I thought this was a problem specific to brew, but I was also able to reproduce this in Ubuntu using our current beta installed via pipx (pipx install jrnl==4.1-beta0). The beta removes the colors, whereas v4.0.1 shows the colors. I think this issue was introduced by #1693 which makes sense, since it affects pretty printing and the latest jrnl homebrew formula has incorporated it, probably to solve the same problem of Python 3.12 compatibility.

I'm working on a fix now.

@micahellison
Copy link
Member

This is resolved in the latest jrnl beta, v4.1b2. I've just tested it after using pipx to install it. Once we release 4.1, it should be fixed in Homebrew.

@h0adp0re
Copy link
Author

h0adp0re commented Nov 1, 2023

Thank you very much for the quick work @micahellison! I've pinned my installation to 4.0.0 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants