Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Commit

Permalink
FileNotFoundError is python3 only, support IOError. Fix #29
Browse files Browse the repository at this point in the history
  • Loading branch information
voyageur committed Aug 26, 2018
1 parent aaf6249 commit ccabc37
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions dagr/dagr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,21 @@
expanduser, join as path_join
)
from random import choice
from requests import (
adapters as req_adapters,
codes as req_codes,
session as req_session
)
from mechanicalsoup import StatefulBrowser

# Python 2/3 compatibility stuff
try:
# Python 3
import configparser
except ImportError:
# Python 2
import ConfigParser as configparser

from mechanicalsoup import StatefulBrowser
from requests import (
adapters as req_adapters,
codes as req_codes,
session as req_session
)
FNF_Error = getattr(__builtins__, 'FileNotFoundError', IOError)


# Helper functions
Expand All @@ -56,7 +57,7 @@ class Dagr:
"""deviantArt gallery ripper class"""

NAME = basename(__file__)
__version__ = "0.70"
__version__ = "0.70.1"
MAX_DEVIATIONS = 1000000 # max deviations
ART_PATTERN = (r"https://www\.deviantart\.com/"
r"[a-zA-Z0-9_-]*/art/[a-zA-Z0-9_-]*")
Expand Down Expand Up @@ -253,7 +254,7 @@ def get_images(self, mode, mode_arg, pages):
try:
with open(base_dir + "/.dagr_downloaded_pages", "r") as filehandle:
existing_pages = json.load(filehandle)
except FileNotFoundError as fnf_error:
except FNF_Error as fnf_error:
# May not exist (new directory, ...)
pass
if not self.overwrite:
Expand Down

0 comments on commit ccabc37

Please sign in to comment.