varietywalls / variety

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

Preferences not loading when ~/Pictures/Wallpapers folder does not exist #425

Open patvdv opened 3 years ago

patvdv commented 3 years ago

Version of Variety

0.8.5

Describe the bug

The preferences dialog will not open. Running the cli version shows the problem:

$ variety --preferences
WARNING: 2021-03-24 21:36:21,516: create_menu() 'Variety Slideshow is not installed. This is an optional extension adding pan-and-zoom slideshows to Variety: see https://github.com/peterlevi/variety-slideshow for details'
ERROR: 2021-03-24 21:36:21,767: cleanup_old_wallpapers() 'Cannot remove all old wallpaper files from /home/patrick/Pictures/Wallpapers:'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 2647, in cleanup_old_wallpapers
    for name in os.listdir(folder):
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
ERROR: 2021-03-24 21:36:21,768: apply_copyto_operation() 'Could not copy file /home/patrick/.config/variety/wallpaper/wallpaper-clock-e7c26354a72ccfd539719ef5ab4a2b2b.jpg to copyto folder /home/patrick/Pictures/Wallpapers. Using it from original locations, so LightDM might not be able to use it.'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 1427, in apply_copyto_operation
    shutil.copy(to_set, target_file)
  File "/usr/lib/python3.8/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.8/shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers/variety-copied-wallpaper-1aac4fd87b196fff5a3defe60d8d86eb.jpg'
ERROR: 2021-03-24 21:36:22,809: get_file_icon_name() 'Exception while obtaining folder icon for /home/patrick/Pictures/Wallpapers:'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/Util.py", line 779, in get_file_icon_name
    query_info = f.query_info("standard::icon", Gio.FileQueryInfoFlags.NONE, None)
gi.repository.GLib.GError: g-io-error-quark: Error when getting information for file “/home/patrick/Pictures/Wallpapers”: No such file or directory (1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 205, in _delayed
    self.create_preferences_dialog()
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 242, in create_preferences_dialog
    self.preferences_dialog = PreferencesVarietyDialog(parent=self)  # pylint: disable=E1102
  File "/usr/lib/python3/dist-packages/variety_lib/PreferencesDialog.py", line 40, in __new__
    new_object.finish_initializing(builder, parent)
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 90, in finish_initializing
    self.reload()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 344, in reload
    self.on_copyto_enabled_toggled()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1205, in on_copyto_enabled_toggled
    self.on_copyto_changed()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1219, in on_copyto_changed
    can_read = os.stat(folder).st_mode | stat.S_IROTH
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_variety.1026.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 205, in _delayed
    self.create_preferences_dialog()
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 242, in create_preferences_dialog
    self.preferences_dialog = PreferencesVarietyDialog(parent=self)  # pylint: disable=E1102
  File "/usr/lib/python3/dist-packages/variety_lib/PreferencesDialog.py", line 40, in __new__
    new_object.finish_initializing(builder, parent)
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 90, in finish_initializing
    self.reload()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 344, in reload
    self.on_copyto_enabled_toggled()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1205, in on_copyto_enabled_toggled
    self.on_copyto_changed()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1219, in on_copyto_changed
    can_read = os.stat(folder).st_mode | stat.S_IROTH
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
ERROR: 2021-03-24 21:36:23,094: cleanup_old_wallpapers() 'Cannot remove all old wallpaper files from /home/patrick/Pictures/Wallpapers:'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 2647, in cleanup_old_wallpapers
    for name in os.listdir(folder):
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
ERROR: 2021-03-24 21:36:23,095: apply_copyto_operation() 'Could not copy file /home/patrick/.config/variety/wallpaper/wallpaper-clock-655598334e7a4b687d1113981e4be69a.jpg to copyto folder /home/patrick/Pictures/Wallpapers. Using it from original locations, so LightDM might not be able to use it.'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 1427, in apply_copyto_operation
    shutil.copy(to_set, target_file)
  File "/usr/lib/python3.8/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.8/shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers/variety-copied-wallpaper-1504cb34392e9798b97e2fde10c90be8.jpg'
ERROR: 2021-03-24 21:36:24,730: get_file_icon_name() 'Exception while obtaining folder icon for /home/patrick/Pictures/Wallpapers:'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/Util.py", line 779, in get_file_icon_name
    query_info = f.query_info("standard::icon", Gio.FileQueryInfoFlags.NONE, None)
gi.repository.GLib.GError: g-io-error-quark: Error when getting information for file “/home/patrick/Pictures/Wallpapers”: No such file or directory (1)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 2425, in _process_command
    self.on_mnu_preferences_activate()
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 269, in on_mnu_preferences_activate
    self.create_preferences_dialog()
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 242, in create_preferences_dialog
    self.preferences_dialog = PreferencesVarietyDialog(parent=self)  # pylint: disable=E1102
  File "/usr/lib/python3/dist-packages/variety_lib/PreferencesDialog.py", line 40, in __new__
    new_object.finish_initializing(builder, parent)
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 90, in finish_initializing
    self.reload()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 344, in reload
    self.on_copyto_enabled_toggled()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1205, in on_copyto_enabled_toggled
    self.on_copyto_changed()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1219, in on_copyto_changed
    can_read = os.stat(folder).st_mode | stat.S_IROTH
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 153, in apport_excepthook
    with os.fdopen(os.open(pr_filename,
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_variety.1026.crash'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 2425, in _process_command
    self.on_mnu_preferences_activate()
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 269, in on_mnu_preferences_activate
    self.create_preferences_dialog()
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 242, in create_preferences_dialog
    self.preferences_dialog = PreferencesVarietyDialog(parent=self)  # pylint: disable=E1102
  File "/usr/lib/python3/dist-packages/variety_lib/PreferencesDialog.py", line 40, in __new__
    new_object.finish_initializing(builder, parent)
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 90, in finish_initializing
    self.reload()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 344, in reload
    self.on_copyto_enabled_toggled()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1205, in on_copyto_enabled_toggled
    self.on_copyto_changed()
  File "/usr/lib/python3/dist-packages/variety/PreferencesVarietyDialog.py", line 1219, in on_copyto_changed
    can_read = os.stat(folder).st_mode | stat.S_IROTH
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
WARNING: 2021-03-24 21:36:26,161: get_one_quote() 'No quotes for '' for plugin Local text files'
^CTerminating signal received, quitting...
ERROR: 2021-03-24 21:36:38,781: cleanup_old_wallpapers() 'Cannot remove all old wallpaper files from /home/patrick/Pictures/Wallpapers:'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 2647, in cleanup_old_wallpapers
    for name in os.listdir(folder):
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers'
ERROR: 2021-03-24 21:36:38,781: apply_copyto_operation() 'Could not copy file /home/patrick/.config/variety/Downloaded/Unsplash/photo-1616021681311-77014f42f9da.jpg to copyto folder /home/patrick/Pictures/Wallpapers. Using it from original locations, so LightDM might not be able to use it.'
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/variety/VarietyWindow.py", line 1427, in apply_copyto_operation
    shutil.copy(to_set, target_file)
  File "/usr/lib/python3.8/shutil.py", line 415, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.8/shutil.py", line 261, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/patrick/Pictures/Wallpapers/variety-copied-wallpaper-87a09634b3431b96bcd13fd26e3dbb74.jpg'

Context

I deleted the Wallpapers sub-directory thinking it was not necessary. Recreating it makes the Preferences dialog work again.

To Reproduce

  1. Delete ~/Pictures/Wallpapers
  2. Try to open the Preferences dialog

Desktop environment and version

Linux Mint 20 Cinnamon GNOME

OS name and version

$ cat /etc/os-release 
NAME="Linux Mint"
VERSION="20.1 (Ulyssa)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 20.1"
VERSION_ID="20.1"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.linuxmint.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=ulyssa
UBUNTU_CODENAME=focal
peterlevi commented 2 years ago

What is ~/Pictures/Wallpapers configured for in your case? This is not a folder that Variety uses by default. Can you please run variety -v, make it crash, and attach the full log file here (it's in ~/.config/variety/variety.log).