Import function from external library

Hi,
I want to add recaptcha to my form,
I found this library http://pythonhosted.org/recaptcha/
and it works perfect in a separate python file

from recaptcha import RecaptchaClient
recaptcha_client = RecaptchaClient(‘private key’, ‘public key’)

When I put the previous code in my frappe application
This happed :frowning:
Traceback (innermost last):
File “/vagrant/frappe-bench/apps/frappe/frappe/website/render.py”, line 25, in render
data = render_page_by_language(path)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/render.py”, line 91, in render_page_by_language
return render_page(path)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/render.py”, line 107, in render_page
return build(path)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/render.py”, line 114, in build
return build_page(path)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/render.py”, line 127, in build_page
context = get_context(path)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/context.py”, line 16, in get_context
context = build_context(context)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/context.py”, line 34, in build_context
ret = context.doc.get_context(context)
File “/vagrant/frappe-bench/apps/frappe/frappe/website/doctype/web_page/web_page.py”, line 59, in get_context
context = self.get_dynamic_context(frappe._dict(context))
File “/vagrant/frappe-bench/apps/frappe/frappe/website/doctype/web_page/web_page.py”, line 228, in get_dynamic_context
module = imp.load_source(basename, module_path)
File “/vagrant/frappe-bench/apps/erpsystem/erpsystem/www/login_erp.py”, line 1, in
from recaptcha import RecaptchaClient
ImportError: No module named recaptcha

HELP

Add it to your virtual env

./env/bin/pip install recaptcha

5 Likes

Thank You