From: Steven Tobin Date: Sat, 2 Jun 2012 09:57:25 +0000 (+0100) Subject: removed use of 'with' for back-compatibility X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=40c6dd7da7d20d721b3f3d51e39ac17a58c0428e;p=redacted-XKCD-password-generator.git removed use of 'with' for back-compatibility --- diff --git a/xkcd-password.py b/xkcd-password.py index fa3cb69..98c19d4 100755 --- a/xkcd-password.py +++ b/xkcd-password.py @@ -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