[Python-es] Importar libreria Cliente Captcha

Mario Alfonso Saucedo Gomez msagom en gmail.com
Dom Sep 7 21:06:11 CEST 2014


Buenos días,

Quiero consultarles si alguno ha integrado el cliente en mención para
validar esto en un formulario contacto. hice la instalación en mi ambiente
del cliente, generé los respectivos modelos, vistas y formularios pero
cuando ingreso esta línea en view.py no me importa la librería alguién me
puede orientar que me falta.

Versión django 1.6 Python 3.4.1

from recaptcha.client import captcha

remito el log de errores

0 errors found
September 07, 2014 - 14:02:10
Django version 1.6, using settings 'AweC.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Internal Server Error: /
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\django\core\handlers\base.py", line
101, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
320, in resolve
    sub_match = pattern.resolve(new_path)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
222, in resolve
    return ResolverMatch(self.callback, args, kwargs, self.name)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
229, in callback
    self._callback = get_callable(self._callback_str)
  File "C:\Python34\lib\site-packages\django\utils\functional.py", line 32,
in wrapper
    result = func(*args)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
96, in get_callable
    mod = import_module(mod_name)
  File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in
_find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in
_call_with_frames_removed
  File "C:/Developer/Python/AweC\WebHome\views.py", line 4, in <module>
    from recaptcha.client import captcha
  File "C:\Python34\lib\site-packages\recaptcha\client\captcha.py", line 1,
in <module>
    import urllib2, urllib
ImportError: No module named 'urllib2'
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\django\core\handlers\base.py", line
101, in get_response
    resolver_match = resolver.resolve(request.path_info)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
320, in resolve
    sub_match = pattern.resolve(new_path)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
222, in resolve
    return ResolverMatch(self.callback, args, kwargs, self.name)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
229, in callback
    self._callback = get_callable(self._callback_str)
  File "C:\Python34\lib\site-packages\django\utils\functional.py", line 32,
in wrapper
    result = func(*args)
  File "C:\Python34\lib\site-packages\django\core\urlresolvers.py", line
96, in get_callable
    mod = import_module(mod_name)
  File "C:\Python34\lib\importlib\__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in
_find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in
_call_with_frames_removed
  File "C:/Developer/Python/AweC\WebHome\views.py", line 4, in <module>
    from recaptcha.client import captcha
  File "C:\Python34\lib\site-packages\recaptcha\client\captcha.py", line 1,
in <module>
    import urllib2, urllib
ImportError: No module named 'urllib2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python34\lib\wsgiref\handlers.py", line 137, in run
    self.result = application(self.environ, self.start_response)
  File
"C:\Python34\lib\site-packages\django\contrib\staticfiles\handlers.py",
line 67, in __call__
    return self.application(environ, start_response)
  File "C:\Python34\lib\site-packages\django\core\handlers\wsgi.py", line
206, in __call__
    response = self.get_response(request)
  File "C:\Python34\lib\site-packages\django\core\handlers\base.py", line
196, in get_response
    response = self.handle_uncaught_exception(request, resolver,
sys.exc_info())
  File "C:\Python34\lib\site-packages\django\core\handlers\base.py", line
231, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "C:\Python34\lib\site-packages\django\views\debug.py", line 69, in
technical_500_response
    html = reporter.get_traceback_html()
  File "C:\Python34\lib\site-packages\django\views\debug.py", line 323, in
get_traceback_html
    c = Context(self.get_traceback_data())
  File "C:\Python34\lib\site-packages\django\views\debug.py", line 281, in
get_traceback_data
    frames = self.get_traceback_frames()
  File "C:\Python34\lib\site-packages\django\views\debug.py", line 428, in
get_traceback_frames
    pre_context_lineno, pre_context, context_line, post_context =
self._get_lines_from_file(filename, lineno, 7, loader, module_name)
  File "C:\Python34\lib\site-packages\django\views\debug.py", line 379, in
_get_lines_from_file
    source = loader.get_source(module_name)
  File "<frozen importlib._bootstrap>", line 560, in
_requires_frozen_wrapper
ImportError: 'importlib._bootstrap' is not a frozen module
[07/Sep/2014 14:02:55] "GET / HTTP/1.1" 500 59



Cordialmente,

Mario Alfonso Saucedo Gómez
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://mail.python.org/pipermail/python-es/attachments/20140907/55bf9a8f/attachment.html>


Más información sobre la lista de distribución Python-es