0

I am using python 2.7.11 on windows 7 64bit with py2exe 0.6.9, I got the following error after running the .exe file.

ValueError: Multibackend cannot be initialized with no backends.

If you are seeing this error when trying to use default_backend() please try uninstalling and reinstalling cryptography.

Community
  • 1
  • 1
fouad sar
  • 1
  • 2

1 Answers1

0

i wrote bellow code then the problem has been solved.

def patch_crypto_be_discovery():

"""
Monkey patches cryptography's backend detection.
Objective: support pyinstaller freezing.
"""

from cryptography.hazmat import backends

try:
    from cryptography.hazmat.backends.commoncrypto.backend import backend as be_cc
except ImportError:
    be_cc = None

try:
    from cryptography.hazmat.backends.openssl.backend import backend as be_ossl
except ImportError:
    be_ossl = None

backends._available_backends_list = [
    be for be in (be_cc, be_ossl) if be is not None
]

patch_crypto_be_discovery()
fouad sar
  • 1
  • 2