From 2378aafd0ababffbefc21cfde40f1aadc1d28909 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sat, 19 Dec 2015 18:22:13 -0500 Subject: lps_gen.read_file: Added error handling. --- lps_gen.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lps_gen.py') diff --git a/lps_gen.py b/lps_gen.py index 00d6b42..d6072fe 100644 --- a/lps_gen.py +++ b/lps_gen.py @@ -48,9 +48,12 @@ def read_file(filename): """ content = '' - with open(filename, 'rb') as f: - for line in f: - content = content + line + try: + with open(filename, 'rb') as f: + for line in f: + content = content + line + except IOError: + print "Error: unable to open %s" % filename return content -- cgit v1.2.3