Skip to content

Commit

Permalink
diffconfig: Gracefully exit if the default config files are not present
Browse files Browse the repository at this point in the history
Handle gracefully the instance where config files are not present.
Compatible with python versions 2.5, 2.6 and 2.7.
The try/except is forward compatible with python version 3 once the entire script is ported.

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
  • Loading branch information
Mike Pagano authored and Michal Marek committed Aug 19, 2013
1 parent 11097a0 commit 6bf2e84
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/diffconfig
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,13 @@ def main():
configa_filename = sys.argv[1]
configb_filename = sys.argv[2]

a = readconfig(file(configa_filename))
b = readconfig(file(configb_filename))
try:
a = readconfig(file(configa_filename))
b = readconfig(file(configb_filename))
except (IOError):
e = sys.exc_info()[1]
print("I/O error[%s]: %s\n" % (e.args[0],e.args[1]))
usage()

# print items in a but not b (accumulate, sort and print)
old = []
Expand Down

0 comments on commit 6bf2e84

Please sign in to comment.