Edgewall Software
Modify

Opened 16 years ago

Closed 14 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 anonymous, 16 years ago

trac.ini contains

...

[spam-filter]
akismet_api_key =
akismet_api_url = rest.akismet.com/1.1/
akismet_karma = 5
attachment_sample_size = 16384
captcha = ImageCaptcha
captcha_expression_ceiling = 10
captcha_expression_terms = 3
captcha_karma = 10
captcha_karma_lifetime = 86400
extlinks_karma = 2
ip_throttle_karma = 3
logging_enabled = true
max_external_links = 4
max_posts_by_ip = 10
min_karma = 1
purge_age = 160
regex_karma = 5
reject_handler = CaptchaSystem
session_karma = 9
trust_authenticated = true

...

comment:2 by anonymous, 16 years ago

This is a follow up to #7148

comment:3 by shendric@…, 16 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')

in reply to:  3 comment:4 by anonymous, 16 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 Christian Boos, 16 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 anonymous, 16 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 Christian Boos, 16 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 anonymous, 16 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:9 by anonymous, 16 years ago

Wait, let me install TKINTER, will get back to you…

comment:10 by Christian Boos, 16 years ago

Don't bother, TKINTER has nothing to do with this.

comment:11 by Remy Blank, 15 years ago

Milestone: not applicable

comment:12 by Christian Boos, 14 years ago

Milestone: not applicable
Resolution: worksforme
Status: newclosed

Looks like an InstallationIssue, last time I checked this was working fine.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matthew Good.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Matthew Good to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.