markubiak / wallpaper-reddit

Downloads and sets wallpapers pulled from reddit.com
GNU General Public License v3.0
113 stars 42 forks source link

Crash on missing desktop environment #54

Open sanderd17 opened 5 years ago

sanderd17 commented 5 years ago

I assume this was introduced with #44

But apparently, DESKTOP_SESSION is None when using i3.

[sander@ATLPOR13 ~]$ wallpaper-reddit wallpapers
searching for valid images...
downloading https://i.imgur.com/kE2yyYK.jpg
Traceback (most recent call last):
  File "/usr/bin/wallpaper-reddit", line 11, in <module>
    load_entry_point('wallpaper-reddit==3.1.1', 'console_scripts', 'wallpaper-reddit')()
  File "/usr/lib/python3.7/site-packages/wpreddit/main.py", line 46, in run
    wallpaper.set_wallpaper()
  File "/usr/lib/python3.7/site-packages/wpreddit/wallpaper.py", line 25, in set_wallpaper
    linux_wallpaper()
  File "/usr/lib/python3.7/site-packages/wpreddit/wallpaper.py", line 40, in linux_wallpaper
    elif check_de(de, ["gnome", "gnome-xorg", "gnome-wayland", "unity", "ubuntu", "ubuntu-xorg", "budgie-desktop"]):
  File "/usr/lib/python3.7/site-packages/wpreddit/wallpaper.py", line 31, in check_de
    return any([de in current_de for de in list_of_de])
  File "/usr/lib/python3.7/site-packages/wpreddit/wallpaper.py", line 31, in <listcomp>
    return any([de in current_de for de in list_of_de])
TypeError: argument of type 'NoneType' is not iterable
sanderd17 commented 5 years ago

Hmm, setting the DESKTOP_SESSION inside my bashrc also did the trick. Not sure what to do with this.

markubiak commented 5 years ago

I think your assessment that it was introduced by #44 is correct. I'll dig through, likely forgot to check for an empty list somewhere.

Mark