Solve the problem of "bipwallet\wallet.py decoding str is not supported"

    When using Python to generate mnemonic words for ETH or BTC, you need to install the bipwallet dependency package, as follows:

pip install bipwallet==1.0.1

    Use the ethCreate.py script to generate mnemonic words, public key, and private key.
    //ethCreate.py


from bipwallet import wallet

# generate 12 word mnemonic seed
seed = wallet.generate_mnemonic()

# create bitcoin wallet
##w = wallet.create_wallet(network="BTC", seed=seed, children=1)
w = wallet.create_wallet(network="ETH", seed=seed, children=1)


print(w)

    Run the command: python ethCreate.py
    pops up the following error:


Figure (1) wallet.py reports "decoding str is not supported" error

    The reason for this problem is that the encoding of the current system is inconsistent with the compilation of Python, so str cannot be decoded. You can delete the encoding parameter in str(A, encoding="uft-8") to let Python decode it freely. Proceed as follows:

    1) For versions below bipwallet v1.01 , you need to open the C:\Python38\Lib\site-packages\bipwallet\wallet.py file,
    press Ctrl+H, and
    set the second parameter in the str() statement, encoding ="utf-8" is all replaced with blanks , that is, the system default encoding is used.

Figure (2) Remove the encoding="utf-8" parameter in the str() statement

    2) For the version above bipwallet v1.0.2 , you need to uninstall it first, then modify the wallet.py source code, and then install it with setup.py. The steps are as follows:
    2.1) Uninstall bipwallet v1.0.2

pip uninstall bipwallet

    2.2) Download bipwallet v1.0.2.rar source package
    Ali mirror: bipwall v1.0.2.rar
    official website mirror: bipwall v1.0.2.rar

    2.3) Unzip bipwallet v1.0.2.rar, open the bipwallet\wallet.py file inside, and then replace the second parameter in the str() statement, encoding="utf-8", with all blanks.

    2.4) In the bipwallet directory, use its built-in setup.py script to install

python setup.py install

Guess you like

Origin blog.csdn.net/sanqima/article/details/109749395