Skip to content

Commit

Permalink
Fixes Python 2.7 exception handling ...
Browse files Browse the repository at this point in the history
  • Loading branch information
prashnts committed Sep 17, 2016
1 parent 4d19ea0 commit 9e8d756
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hues/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

CONFIG_FNAME = '.hues.yml'

if sys.version_info.major == 2:
class FileNotFoundError(IOError):
'''Implement FileNotFoundError in Python 2'''


class InvalidConfiguration(Exception):
'''Raise when configuration is invalid.'''
Expand Down Expand Up @@ -35,7 +39,7 @@ def _load(cdir, recurse=False):
if type(conf) is not dict:
raise InvalidConfiguration('Configuration at %s is not a dictionary.' % confl)
return conf
except OSError:
except FileNotFoundError:
parent = os.path.dirname(cdir)
if recurse and parent != cdir:
return _load(parent, recurse=True)
Expand Down

0 comments on commit 9e8d756

Please sign in to comment.