no luck installing python client

414 views
Skip to first unread message

anentropic

unread,
Dec 11, 2009, 11:47:02 AM12/11/09
to reCAPTCHA
I am trying to install this on OS X (for a Django site) and it's not
working :(

I did "python setup.py install" and it copied the egg file to my site-
packages, but didn't expand it.
I tried manually copying the recaptcha/ folder into site-packages but
it doesn't work either...

Both times I get MOD_PYTHON error (not even django-styled):
from recaptcha.client import captcha
ImportError: No module named client

I got the tarball manually from pypi, it is 1.0.5 and has an
ezy_install.py inside. Help please!

Eventually I copied the recaptcha/ folder into my Django project, that
works but I shouldn't have to do that.

Any ideas?

Mike Ramirez

unread,
Dec 11, 2009, 12:31:10 PM12/11/09
to reca...@googlegroups.com

The problem is that when you're installing it it's not in your PYTHONPATH[1].
In your directives for apache/mod_python make sure you add the path to the
recaptch-client package like you do your django project settings.

<Location />
...
PythonPath
"['/home/django/web/projects','/home/django/web/projects/myproject',
'/usr/local/lib/python2.6/site-packages', ]+sys.path"
...
</Location>

for ease I like using easy_install, below that is a simple test to see if it
is in your PYTHONPATH.

$ sudo easy_install recaptcha-client
[sudo] password for gufymike:
Searching for recaptcha-client
Best match: recaptcha-client 1.0.5
Processing recaptcha_client-1.0.5-py2.6.egg
recaptcha-client 1.0.5 is already the active version in easy-install.pth

Using /usr/lib/python2.6/site-packages/recaptcha_client-1.0.5-py2.6.egg
Processing dependencies for recaptcha-client
Finished processing dependencies for recaptcha-client

$ python -c 'from recaptcha.client import captcha'
$ python -c 'from recaptcha.client import captchas'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: cannot import name captchas


First one shows it works, second one was to show what happens if it errors.


Mike

[1] http://docs.python.org/using/cmdline.html#envvar-PYTHONPATH

--
If all be true that I do think,
There be five reasons why one should drink;
Good friends, good wine, or being dry,
Or lest we should be by-and-by,
Or any other reason why.

signature.asc
Reply all
Reply to author
Forward
0 new messages