Reputation: 29084
i am trying to get the simple captcha to work with my django.
After following the four steps:
I ran python manage.py test captcha.
It gave me this:
Traceback (most recent call last):
File "/Users/cnnlakshmen_2000/Projects/Permissions/captcha/tests/__init__.py", line 26, in testImages
response = self.client.get(reverse('captcha-image', kwargs=dict(key=key)))
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/test/client.py", line 439, in get
response = super(Client, self).get(path, data=data, **extra)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/test/client.py", line 244, in get
return self.request(**r)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response
response = callback(request, *callback_args, **callback_kwargs)
File "/Users/cnnlakshmen_2000/Projects/Permissions/captcha/views.py", line 27, in captcha_image
font = ImageFont.truetype(settings.CAPTCHA_FONT_PATH, settings.CAPTCHA_FONT_SIZE)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL/ImageFont.py", line 218, in truetype
return FreeTypeFont(filename, size, index, encoding)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL/ImageFont.py", line 134, in __init__
self.font = core.getfont(file, size, index, encoding)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL/ImageFont.py", line 34, in __getattr__
raise ImportError("The _imagingft C module is not installed")
ImportError: The _imagingft C module is not installed
But i actually have installed pil.
I typed sudo pip install pil, it gives me this:
Requirement already satisfied (use --upgrade to upgrade): pil in /Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/PIL
Cleaning up...
Not sure where my error is... Need some guidance...
Upvotes: 1
Views: 2072
Reputation: 771
Have a look at _imagingft module not installed
PIL has a number of optional libs (FreeType, Jpeg etc) if those libraries are missing then certain functionality in PIL will not be available.
Upvotes: 2