catpcha.py: Use opts.output

Script fails on macOS Python 3.9.2 otherwise, with "name 'output' is not
defined".

Change-Id: Id3df19b4a4dedf69f860f1a41348770ac1207377
(cherry picked from commit d1bc02e2fb)
This commit is contained in:
Kosta Harlan 2024-01-16 08:02:33 +01:00 committed by Reedy
parent 12794e686c
commit ab98badbb6
2 changed files with 4 additions and 4 deletions

View file

@ -204,11 +204,11 @@ def run_in_thread(object):
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
filename = "image_%s_%s.png" % (salt, md5hash)
if opts.dirs:
subdir = gen_subdir(output, md5hash, dirs)
subdir = gen_subdir(opts.output, md5hash, dirs)
filename = os.path.join(subdir, filename)
if opts.verbose:
print(filename)
gen_captcha(word, font, fontsize, os.path.join(output, filename))
gen_captcha(word, font, fontsize, os.path.join(opts.output, filename))
if __name__ == '__main__':
"""This grabs random words from the dictionary 'words' (one

View file

@ -221,11 +221,11 @@ def run_in_thread(object):
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
filename = "image_%s_%s.png" % (salt, md5hash)
if opts.dirs:
subdir = gen_subdir(output, md5hash, dirs)
subdir = gen_subdir(opts.output, md5hash, dirs)
filename = os.path.join(subdir, filename)
if opts.verbose:
print(filename)
gen_captcha(word, font, fontsize, os.path.join(output, filename))
gen_captcha(word, font, fontsize, os.path.join(opts.output, filename))
if __name__ == '__main__':
"""This grabs random words from the dictionary 'words' (one