0

I am having issue using the Flask Session Captcha as the module flask_session_captcha seems to call captcha in a broken way. The Catpcha python package says it will provide captcha.image as long as the module captcha is installed but it is not working.

I get the following error when I try to launch my Flask app when flask_session_captcha tries to load the captcha.image module:

Error: While importing "captcha", an ImportError was raised:

Traceback (most recent call last):
  File "/home/john/devel/Flask/authcaptcha/venv/lib64/python3.9/site-packages/flask/cli.py", line 240, in locate_app
    __import__(module_name)
  File "/home/john/devel/Flask/authcaptcha/captcha.py", line 5, in <module>
    from flask_session_captcha import FlaskSessionCaptcha
  File "/home/john/devel/Flask/authcaptcha/venv/lib64/python3.9/site-packages/flask_session_captcha/__init__.py", line 5, in <module>
    from captcha.image import ImageCaptcha
ModuleNotFoundError: No module named 'captcha.image'; 'captcha' is not a package

I have ran pip install captcha and version 0.3-py3-none-any is installed.

John Tate
  • 780
  • 3
  • 10
  • 23

1 Answers1

2

Don't name your module as capture.py, it's the same with the package name (capture) and it will cause the import conflict.

Grey Li
  • 11,664
  • 4
  • 54
  • 64