Apr-26-2017, 03:54 PM
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> def scan(pathname, signatures, depth): ... for item in os.listdir(pathname) and depth > 0: ... n = os.path.join(pathname, item) ... try: ... scan(n, signatures, depth-1) ... except: ... f = open(n, 'r') ... s = f.read() ... for virus in signatures: ... if s.find(signatures[virus]) > 0: ... print('{}, found virus {}'.format(n,virus)) ... f.close() ... >>>Works fine for me. Please show the whole error, and probably more of your actual script. Otherwise, we're just taking wild guesses.