Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[passlib.handlers.bcrypt:WARNING] (trapped) error reading bcrypt version #8418

Open
wenion opened this issue Jan 7, 2024 · 2 comments
Open

Comments

@wenion
Copy link

wenion commented Jan 7, 2024

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
version = _bcrypt.about.version
AttributeError: module 'bcrypt' has no attribute 'about'

I think the passlib v1.7.4 didn't support bcrypt v4.1.2. There is no about.py file in bcrypt v4.1.2 package

@robertknight
Copy link
Member

To add context, this is a warning that appears in the logs when performing an action in Hypothesis that encrypts a password.

Steps to reproduce in development:

  1. Go to http://localhost:5000/account/settings
  2. Change your password (the new one can be the same as the old)

The following appears in the logs:

web (stderr)         | 2024-03-04 09:37:56,520 [48366] [passlib.handlers.bcrypt:WARNING] (trapped) error reading bcrypt version
web (stderr)         | Traceback (most recent call last):
web (stderr)         |   File "/Users/robert/hypothesis/h/.tox/dev/lib/python3.11/site-packages/passlib/handlers/bcrypt.py", line 620, in _load_backend_mixin
web (stderr)         |     version = _bcrypt.__about__.__version__
web (stderr)         |               ^^^^^^^^^^^^^^^^^
web (stderr)         | AttributeError: module 'bcrypt' has no attribute '__about__'

The warning on its own is harmless since the version variable here is only used to write a message to debug logs. See upstream code:

try:
    version = _bcrypt.__about__.__version__
except:
    log.warning("(trapped) error reading bcrypt version", exc_info=True)
    version = '<unknown>'

log.debug("detected 'bcrypt' backend, version %r", version)
return mixin_cls._finalize_backend_mixin(name, dryrun)

@robertknight
Copy link
Member

robertknight commented Mar 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants