randomdrake / nasa-apod-desktop

Automatically downloads and sets the NASA picture of the day (APOD) as your desktop in Ubuntu.
Apache License 2.0
148 stars 62 forks source link

Crash when the image is linked to something that is a 404. #8

Closed randomdrake closed 12 years ago

randomdrake commented 12 years ago

Need to make sure the link we find isn't a 404. If it is, use the src of the image instead of the href it links to.

randomdrake:~$ ./nasa_apod_desktop.py Starting Using default resolution of 1680x1050 Using automatically detected path: /home/randomdrake/Downloads/nasa-apod-backgrounds Downloading contents of the site to find the image name Grabbing the image URL Found name of image: tethysrings_cassini_1920.jpg File exists, moving on Opening local image Traceback (most recent call last): File "./nasa_apod_desktop.py", line 284, in resize_image(filename) File "./nasa_apod_desktop.py", line 225, in resize_image image = Image.open(filename) File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1980, in open raise IOError("cannot identify image file") IOError: cannot identify image file