removed use of 'with' for back-compatibility
authorSteven Tobin <tobin2402 (at) gmail.com>
Sat, 2 Jun 2012 09:57:25 +0000 (10:57 +0100)
committerSteven Tobin <tobin2402 (at) gmail.com>
Sat, 2 Jun 2012 09:57:25 +0000 (10:57 +0100)
xkcd-password.py

index fa3cb69322bcaa35376f9d89192744cdd97184be..98c19d43cd7439f61792cc03307d9d63c07f35b9 100755 (executable)
@@ -72,11 +72,12 @@ def generate_wordlist(wordfile=None,
     words = []
     regexp = re.compile("^%s{%i,%i}$" % (valid_chars, min_length, max_length))
     try:
-        with open(wordfile) as wlf:
-            for line in wlf:
-                thisword = line.strip()
-                if regexp.match(thisword) is not None:
-                    words.append(thisword)
+        wlf = open(wordfile)
+        for line in wlf:
+            thisword = line.strip()
+            if regexp.match(thisword) is not None:
+                words.append(thisword)
+        wlf.close()
     except:
             print("Word list not loaded")
             raise SystemExit
git clone https://git.99rst.org/PROJECT