Bug 1223003

Summary: jrnl utility give error AttributeError: '_PasswordRetriever' object has no attribute 'encode' when encryption is enabled
Product: [openSUSE] openSUSE Tumbleweed Reporter: Andrea Manzini <andrea.manzini>
Component: OtherAssignee: Malcolm Lewis <malcolmlewis>
Status: RESOLVED WONTFIX QA Contact: E-mail List <qa-bugs>
Severity: Minor    
Priority: P5 - None CC: andrea.manzini
Version: CurrentFlags: malcolmlewis: needinfo? (andrea.manzini)
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Andrea Manzini 2024-04-18 06:31:18 UTC
--- to reproduce on Tumbleweed:

# zypper install jrnl

The following 12 NEW packages are going to be installed:
  jrnl python311-ansiwrap python311-colorama python311-markdown-it-py python311-mdurl python311-parsedatetime
  python311-Pygments python311-pytz python311-pytz-deprecation-shim python311-rich python311-textwrap3 python311-tzlocal


$ rpm -qi jrnl 
Name        : jrnl
Version     : 4.0.1
Release     : 1.4
Architecture: noarch
Install Date: gio 18 apr 2024, 08:14:47
Group       : Unspecified
Size        : 514138
License     : GPL-3.0-only
Signature   : RSA/SHA512, ven 29 mar 2024, 17:09:55, Key ID 35a2f86e29b700a4
Source RPM  : jrnl-4.0.1-1.4.src.rpm
Build Date  : sab 19 ago 2023, 16:03:40
Build Host  : reproducible
Packager    : https://bugs.opensuse.org
Vendor      : openSUSE
URL         : https://jrnl.sh
Summary     : Collect your thoughts and notes without leaving the command line
Description :
Simple journal application for the command line. You can use it to
easily create, search, and view journal entries. Journals are stored
as human-readable plain text, and can also be encrypted using AES
encryption.
Distribution: openSUSE Tumbleweed

--- remove any previous configuration
$ rm -rf $HOME/.config/jrnl

--- create a new journal choosing Yes when asked to encrypt the data 
$ jrnl 
Path to your journal file (leave blank for /home/andrea/.local/share/jrnl/journal.txt):     
Do you want to encrypt your journal? (You can always change this later) [y/N] y
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  Journal will be encrypted  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
Do you want jrnl to use colors when displaying entries? (You can always change this later) [Y/n] 
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  jrnl configuration created at /home/andrea/.config/jrnl/jrnl.yaml  ┃
┃  For advanced features, read the docs at https://jrnl.sh            ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  Journal 'default' created at /home/andrea/.local/share/jrnl/journal.txt  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  AttributeError                                         ┃
┃  '_PasswordRetriever' object has no attribute 'encode'  ┃
┃                                                         ┃
┃  This is probably a bug. Please file an issue at:       ┃
┃  https://github.com/jrnl-org/jrnl/issues/new/choose     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛


--- any subsequent journal entry will give the same error
$ jrnl foobar 
┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃  AttributeError                                         ┃
┃  '_PasswordRetriever' object has no attribute 'encode'  ┃
┃                                                         ┃
┃  This is probably a bug. Please file an issue at:       ┃
┃  https://github.com/jrnl-org/jrnl/issues/new/choose     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

--- note: the bug is not present in upstream, installing the package with pipx works, so most likely the issue is on the package dependencies
Comment 1 Malcolm Lewis 2024-05-22 03:18:09 UTC
(In reply to Andrea Manzini from comment #0)
> --- to reproduce on Tumbleweed:
> 
> # zypper install jrnl
> 
> The following 12 NEW packages are going to be installed:
>   jrnl python311-ansiwrap python311-colorama python311-markdown-it-py
> python311-mdurl python311-parsedatetime
>   python311-Pygments python311-pytz python311-pytz-deprecation-shim
> python311-rich python311-textwrap3 python311-tzlocal
> 
> 
> $ rpm -qi jrnl 
> Name        : jrnl
> Version     : 4.0.1
> Release     : 1.4
> Architecture: noarch
> Install Date: gio 18 apr 2024, 08:14:47
> Group       : Unspecified
> Size        : 514138
> License     : GPL-3.0-only
> Signature   : RSA/SHA512, ven 29 mar 2024, 17:09:55, Key ID 35a2f86e29b700a4
> Source RPM  : jrnl-4.0.1-1.4.src.rpm
> Build Date  : sab 19 ago 2023, 16:03:40
> Build Host  : reproducible
> Packager    : https://bugs.opensuse.org
> Vendor      : openSUSE
> URL         : https://jrnl.sh
> Summary     : Collect your thoughts and notes without leaving the command
> line
> Description :
> Simple journal application for the command line. You can use it to
> easily create, search, and view journal entries. Journals are stored
> as human-readable plain text, and can also be encrypted using AES
> encryption.
> Distribution: openSUSE Tumbleweed
> 
> --- remove any previous configuration
> $ rm -rf $HOME/.config/jrnl
> 
> --- create a new journal choosing Yes when asked to encrypt the data 
> $ jrnl 
> Path to your journal file (leave blank for
> /home/andrea/.local/share/jrnl/journal.txt):     
> Do you want to encrypt your journal? (You can always change this later)
> [y/N] y
> ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
> ┃  Journal will be encrypted  ┃
> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
> Do you want jrnl to use colors when displaying entries? (You can always
> change this later) [Y/n] 
> ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
> ┃  jrnl configuration created at /home/andrea/.config/jrnl/jrnl.yaml  ┃
> ┃  For advanced features, read the docs at https://jrnl.sh            ┃
> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
> ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
> ┃  Journal 'default' created at /home/andrea/.local/share/jrnl/journal.txt  ┃
> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
> ┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
> ┃  AttributeError                                         ┃
> ┃  '_PasswordRetriever' object has no attribute 'encode'  ┃
> ┃                                                         ┃
> ┃  This is probably a bug. Please file an issue at:       ┃
> ┃  https://github.com/jrnl-org/jrnl/issues/new/choose     ┃
> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
> 
> 
> --- any subsequent journal entry will give the same error
> $ jrnl foobar 
> ┏━ Error ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
> ┃  AttributeError                                         ┃
> ┃  '_PasswordRetriever' object has no attribute 'encode'  ┃
> ┃                                                         ┃
> ┃  This is probably a bug. Please file an issue at:       ┃
> ┃  https://github.com/jrnl-org/jrnl/issues/new/choose     ┃
> ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
> 
> --- note: the bug is not present in upstream, installing the package with
> pipx works, so most likely the issue is on the package dependencies

So your issue has been reopened upstream. The work around at present is to uninstall python311-keyring-keyutils, create the encrypted file and password to be saved into the keyring. After that all should be good. You can re-install python311-keyring-keyutils.
Comment 2 Malcolm Lewis 2024-05-22 15:06:56 UTC
So the issue is with python-keyring-keyutils, no response upstream, so think we have some workarounds. So will mark as resolved and add a note in a readme for jrnl.

https://github.com/marcus-h/python-keyring-keyutils/issues/1