diff --git a/core/helpers.py b/core/helpers.py index 3f52545..77358d4 100644 --- a/core/helpers.py +++ b/core/helpers.py @@ -42,21 +42,30 @@ def get_text_files(directory): def detect_installed_file(current_file, test_files): """Returns the file in which is contained in , or "Unknown".""" - current = open(current_file).read() - for f in test_files: - tested = open(f).read() - if tested in current: - return f + try: + current = open(current_file).read() + for f in test_files: + tested = open(f).read() + if tested in current: + return f + except IOError: + pass return "Unknown" def detect_installed_files(current_file, test_files): """Returns a list of files in that are contained in .""" - current = open(current_file).read() installed = [] - for f in test_files: - tested = open(f).read() - if tested in current: - installed.append(f) + try: + current = open(current_file).read() + for f in test_files: + try: + tested = open(f).read() + if tested in current: + installed.append(f) + except IOError: + pass + except IOError: + pass return installed