neif
neif

Reputation: 510

Using python-zxcvbn in Python 3.4

I have been using the zxcvbn, which is a great piece of programming. Especially, the port python-zxcvbn has been perfect for a small project I am doing. Despite this, I am trying to invoke python-zxcvbn from Python 3.4 and I get errors like this:

Traceback (most recent call last):
  File "entropy.py", line 7, in <module>
    from zxcvbn import password_strength
  File "/usr/lib/python3.4/site-packages/zxcvbn/__init__.py", line 1, in <module>
    from zxcvbn import main
  File "/usr/lib/python3.4/site-packages/zxcvbn/main.py", line 3, in <module>
    from zxcvbn.matching import omnimatch
  File "/usr/lib/python3.4/site-packages/zxcvbn/matching.py", line 89, in <module>
    _load_frequency_lists()
  File "/usr/lib/python3.4/site-packages/zxcvbn/matching.py", line 67, in _load_frequency_lists
    dicts = json.loads(data)
  File "/usr/lib/python3.4/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

I have tried both installing the library from github, and with pip, with the same result.

To avoid that, I am currently running python2 in the module that uses zxcvbn, but I'd like to have a cleaner version of my project which runs fully with Python 3.4.

Is anyone successfully using python-zxcvbn with Python 3.4?

Upvotes: 1

Views: 706

Answers (1)

neif
neif

Reputation: 510

As answered by unutbu, there is a fork on github by moreati that is compatible with Python 3.4. It worked flawlessly for me.

https://github.com/moreati/python-zxcvbn

Upvotes: 1

Related Questions