From 43554308ab1f7bb30dde13338968f35239796d48 Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 26 Jan 2015 17:44:11 +0100 Subject: [PATCH] Handling Case of Bad Symlinks --- neopi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neopi.py b/neopi.py index 457759a..7ef8a57 100755 --- a/neopi.py +++ b/neopi.py @@ -306,13 +306,17 @@ def search_file_path(self, args, valid_regex): for root, dirs, files in os.walk(args[0]): for file in files: filename = os.path.join(root, file) - if (valid_regex.search(file) and os.path.getsize(filename) > SMALLEST): + try: + if (valid_regex.search(file) and os.path.getsize(filename) > SMALLEST): try: data = open(root + "/" + file, 'rb').read() except: data = False print "Could not read file :: %s/%s" % (root, file) yield data, filename + except: + pass + if __name__ == "__main__": """Parse all the options"""