varietywalls / variety

Wallpaper downloader and manager for Linux systems
http://peterlevi.com/variety
GNU General Public License v3.0
1.21k stars 146 forks source link

TypeError: can't concat str to bytes , modification proposed #676

Open lours974 opened 10 months ago

lours974 commented 10 months ago

Version of Variety ubuntu 0.8.11-1

Describe the bug

janv. 24 20:00:10 lours variety.desktop[1920612]: Traceback (most recent call last):
janv. 24 20:00:10 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/Util.py", line 876, in cb
janv. 24 20:00:10 lours variety.desktop[1920612]:     args[0](*args[1:])
janv. 24 20:00:10 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 803, in _gtk_update
janv. 24 20:00:10 lours variety.desktop[1920612]:     and self.quote_favorites_contents.find(self.current_quote_to_text()) == -1
janv. 24 20:00:10 lours variety.desktop[1920612]:                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
janv. 24 20:00:10 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 2953, in current_quote_to_text
janv. 24 20:00:10 lours variety.desktop[1920612]:     self.quote["quote"]
janv. 24 20:00:10 lours variety.desktop[1920612]: TypeError: can't concat str to bytes
janv. 24 20:01:01 lours variety.desktop[1920612]: ERROR: 2024-01-24 20:01:01,907: apply_quote() 'Could not apply quote:'
janv. 24 20:01:01 lours variety.desktop[1920612]: Traceback (most recent call last):
janv. 24 20:01:01 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 1454, in apply_quote
janv. 24 20:01:01 lours variety.desktop[1920612]:     QuoteWriter.write_quote(
janv. 24 20:01:01 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/QuoteWriter.py", line 51, in write_quote
janv. 24 20:01:01 lours variety.desktop[1920612]:     raise exception[0]  # pylint: disable=raising-bad-type
janv. 24 20:01:01 lours variety.desktop[1920612]:     ^^^^^^^^^^^^^^^^^^
janv. 24 20:01:01 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/QuoteWriter.py", line 41, in go
janv. 24 20:01:01 lours variety.desktop[1920612]:     QuoteWriter.write_quote_on_surface(surface, quote, author, options)
janv. 24 20:01:01 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/variety/QuoteWriter.py", line 100, in write_quote_on_surface
janv. 24 20:01:01 lours variety.desktop[1920612]:     qlayout.set_text(quote, -1)
janv. 24 20:01:01 lours variety.desktop[1920612]:   File "/usr/lib/python3/dist-packages/gi/overrides/Pango.py", line 54, in set_text
janv. 24 20:01:01 lours variety.desktop[1920612]:     super(Layout, self).set_text(text, length)
janv. 24 20:01:01 lours variety.desktop[1920612]: TypeError: Must be string, not bytes

Context In some quote response don't know when

To Reproduce Don't know

Desktop environment and version gnome wayland

OS name and version

PRETTY_NAME="Ubuntu Noble Numbat (development branch)"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04 (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

** Modification of code : /usr/lib/python3/dist-packages/variety/VarietyWindow.py Orig

2953             self.quote["quote"]
2954             + ("\n-- " + self.quote["author"] if self.quote["author"] else "")  

Modif to

2953             str(self.quote["quote"].decode())
2954             + ("\n-- " + str(self.quote["author"].decode()) if self.quote["author"] else "")  

** Seems to work have to be check by real programmers :-)

Thank you.