Opened 18 years ago
Closed 16 years ago
#7172 closed defect (worksforme)
Cannot find an implementation of the "ICaptchaMethod" interface named "ImageCaptcha".
| Reported by: | shendric | Owned by: | Matthew Good |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | plugin/spamfilter | Version: | devel |
| Severity: | normal | Keywords: | |
| Cc: | shendric@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
How to Reproduce
While doing a GET operation on /captcha, Trac issued an internal error.
Imaging-1.1.6 from PIL was installed using sudo python setup.py install
User Agent was: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
System Information
| Trac | 0.11dev-r6886
|
| Python | 2.4.3 (#2, Oct 6 2006, 08:04:11) [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)]
|
| setuptools | 0.6c8
|
| SQLite | 3.2.8
|
| pysqlite | 2.0.5
|
| Genshi | 0.4.4
|
| mod_python | < 3.2
|
| Subversion | 1.3.1 (r19032)
|
| jQuery: | 1.2.3
|
Python Traceback
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6886-py2.4.egg/trac/web/main.py", line 417, in _dispatch_request
dispatcher.dispatch(req)
File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6886-py2.4.egg/trac/web/main.py", line 197, in dispatch
resp = chosen_handler.process_request(req)
File "/usr/lib/python2.4/site-packages/TracSpamFilter-0.2.1cdev_r6883-py2.4.egg/tracspamfilter/captcha/api.py", line 90, in process_request
result, html = self.captcha.generate_captcha(req)
File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6886-py2.4.egg/trac/config.py", line 462, in __get__
raise AttributeError('Cannot find an implementation of the "%s" '
AttributeError: Cannot find an implementation of the "ICaptchaMethod" interface named "ImageCaptcha". Please update the option spam-filter.captcha in trac.ini.
Attachments (0)
Change History (12)
comment:1 by , 18 years ago
follow-up: 4 comment:3 by , 18 years ago
Also, I tried installing PIL as you suggested and I tried to add the output to this ticket, however, the
Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
No local packages or download links found for PIL
error: Could not find suitable distribution for Requirement.parse('PIL')
comment:4 by , 18 years ago
I keep getting an error (from edgewall's trac system) saying that the post is spam. The previous post was output from using easy install.
comment:5 by , 18 years ago
| Summary: | AttributeError: Cannot find an implementation of the "ICaptchaMethod" interface named "ImageCaptcha". Please update the option spam-filter.captcha in trac.ini. → Cannot find an implementation of the "ICaptchaMethod" interface named "ImageCaptcha". |
|---|
If PIL is not "easy-installed", this won't work, even if you properly enabled the ImageCaptcha component:
[components] ... tracspamfilter.captcha.image.* = enabled ...
Now, on Linux I got the same error as above when doing easy_install PIL, but:
easy_install http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
worked.
comment:6 by , 18 years ago
Ok, I've made the changes and I get a response without an error — but no image. The source of the web page shows that there should be an image, but the resulting web page has no image.
<img width="33%" src="/trac/test/captcha/image" />
I tried to load an image directly and got the following error:
File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6886-py2.4.egg/trac/web/main.py", line 417, in _dispatch_request dispatcher.dispatch(req) File "/usr/lib/python2.4/site-packages/Trac-0.11dev_r6886-py2.4.egg/trac/web/main.py", line 197, in dispatch resp = chosen_handler.process_request(req) File "/usr/lib/python2.4/site-packages/TracSpamFilter-0.2.1cdev_r6883-py2.4.egg/tracspamfilter/captcha/image.py", line 71, in process_request self.font_size) File "/usr/lib/python2.4/site-packages/TracSpamFilter-0.2.1cdev_r6883-py2.4.egg/tracspamfilter/captcha/image.py", line 90, in gen_captcha font = ImageFont.truetype(fnt,fnt_sz) File "/usr/lib/python2.4/site-packages/PIL-1.1.6-py2.4-linux-i686.egg/ImageFont.py", line 205, in truetype return FreeTypeFont(filename, size, index, encoding) File "/usr/lib/python2.4/site-packages/PIL-1.1.6-py2.4-linux-i686.egg/ImageFont.py", line 121, in __init__ self.font = _imagingft.getfont(file, size, index, encoding)
Is it possible that PIL needs a fonts package that I don't have installed?
Thanks!
comment:7 by , 18 years ago
The font provided by default (source:sandbox/spam-filter-captcha/tracspamfilter/fonts) is a TrueType font, so I guess we need the supporting package to be available at the time PIL is built (FreeType). We should perhaps provide another font, or detect that it can be used and revert to a builtin one.
http://www.pythonware.com/library/pil/handbook/imagefont.htm
comment:8 by , 18 years ago
I've installed freetype and reinstalled PIL. The output of the PIL installation is below:
$ sudo easy_install http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
Downloading http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
Processing Imaging-1.1.6.tar.gz
Running Imaging-1.1.6/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P5LHvs/Imaging-1.1.6/egg-dist-tmp-iHmzk7
libImaging/Effects.c:210: warning: 'perlin_init' defined but not used
libImaging/Geometry.c:236: warning: 'quadratic_transform' defined but not used
libImaging/Quant.c:311: warning: 'test_sorted' defined but not used
libImaging/QuantHash.c:136: warning: '_hashtable_test' defined but not used
--------------------------------------------------------------------
PIL 1.1.6 BUILD SUMMARY
--------------------------------------------------------------------
version 1.1.6
platform linux2 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)]
--------------------------------------------------------------------
*** TKINTER support not available (Tcl/Tk 8.4 libraries needed)
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.
To check the build, run the selftest.py script.
zip_safe flag not set; analyzing archive contents...
IcnsImagePlugin: top-level module may be 'python -m' script
Image: module references __file__
ImageFileIO: top-level module may be 'python -m' script
ImageFont: top-level module may be 'python -m' script
ImageStat: top-level module may be 'python -m' script
OleFileIO: top-level module may be 'python -m' script
SpiderImagePlugin: top-level module may be 'python -m' script
WalImageFile: top-level module may be 'python -m' script
PIL 1.1.6 is already the active version in easy-install.pth
Installing pilconvert.py script to /usr/bin
Installing pildriver.py script to /usr/bin
Installing pilfile.py script to /usr/bin
Installing pilfont.py script to /usr/bin
Installing pilprint.py script to /usr/bin
Installed /usr/lib/python2.4/site-packages/PIL-1.1.6-py2.4-linux-i686.egg
Processing dependencies for PIL==1.1.6
Finished processing dependencies for PIL==1.1.6
The selftest.py indicates that 57 tests passed.
Sorry if this has nothing to do with trac, but I don't know what else to try. It looks like it is installed now, but I'm still getting the same error.
comment:11 by , 17 years ago
| Milestone: | → not applicable |
|---|
comment:12 by , 16 years ago
| Milestone: | not applicable |
|---|---|
| Resolution: | → worksforme |
| Status: | new → closed |
Looks like an InstallationIssue, last time I checked this was working fine.



trac.ini contains