Page MenuHomePhabricator

Make captcha(-old)?.py python3 compatible
Closed, ResolvedPublic


From issues on T157734 it'd be nice to try it on python3 for any performance gains...

Event Timeline

Change 337247 had a related patch set uploaded (by Reedy):
Swap print statements to python3 compatible print

That fixes one problem

The second one is, even with python3-pil installed...

This script requires the Python Imaging Library -


from PIL import Image

Patch updated and retitled

time python3 '' --key 'CHANGE_THIS_SECRET!' --output '/tmp/mw-fancycaptcha-1486771866-0b4ca9' --count '100' --dirs '0' --wordlist '/home/reedy/words' --font '/usr/share/fonts/truetype/freefont/FreeMonoBoldOblique.ttf' --blacklist '/home/reedy/badwords'
Generating 100 CAPTCHA images separated in 100.0 image(s) per chunk run by 1 threads...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/", line 914, in _bootstrap_inner
  File "/usr/lib/python3.5/", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "", line 185, in run_in_thread
    for i in range(count):
TypeError: 'float' object cannot be interpreted as an integer

Ok, makes them now work on python3

And the thread patch also updated for similar reasons, and rebased ontop of it

Reedy triaged this task as Medium priority.

Change 337247 merged by jenkins-bot:
Make captcha python scripts python3 compatible