Skip to content

Commit

Permalink
Merge pull request Ape#30 from dominikkarall/master
Browse files Browse the repository at this point in the history
Replace FileNotFoundError with IOError for Python 2 compatibility
  • Loading branch information
Ape authored Mar 19, 2017
2 parents 397c00e + 1257490 commit 86130ea
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions samsungctl/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import os
import socket
import errno

from . import __doc__ as doc
from . import __title__ as title
Expand Down Expand Up @@ -31,10 +32,14 @@ def _read_config():
directories.append("/etc")

for directory in directories:
path = os.path.join(directory, "samsungctl.conf")
try:
config_file = open(os.path.join(directory, "samsungctl.conf"))
except FileNotFoundError:
continue
config_file = open(path)
except IOError as e:
if e.errno == errno.ENOENT:
continue
else:
raise
else:
file_loaded = True
break
Expand Down

0 comments on commit 86130ea

Please sign in to comment.