Git Product home page Git Product logo

Comments (4)

fortesp avatar fortesp commented on May 29, 2024

I am unable to make any conclusion with just the information you pasted here.
How are you executing the script? Which script? Where?
Do you have the most up to date package?
To upgrade the package execute: sudo pip install [package_name] --upgrade
Thanks.

from bitcoinaddress.

cryptofunallday avatar cryptofunallday commented on May 29, 2024

Apologies the formatting was not done correctly. The issue is the example does not run. I have tried on multiple machines, same thing. Using git clone https://github.com/fortesp/bitcoinaddress for my source. Running in ipython here is what happens:

Python 3.9.1 (default, Dec 16 2020, 02:20:47) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.


In [1]: from bitcoinaddress import Wallet
In [2]: wallet = Wallet()
---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)
<ipython-input-2-ea0485b5b53f> in <module>
----> 1 wallet = Wallet()

~/bitcoinaddress/bitcoinaddress/wallet.py in __init__(self, hash_or_seed, testnet)
     13     def __init__(self, hash_or_seed=None, testnet=False):
     14         if hash_or_seed is None: hash_or_seed = Seed()
---> 15         self.key = Key.of(hash_or_seed)
     16         self.address = Address.of(self.key)
     17         self.testnet = testnet

~/bitcoinaddress/bitcoinaddress/key/key.py in of(obj)
     57         key = Key()
     58         if isinstance(obj, Seed):
---> 59             key._from_seed(obj)
     60         else:
     61             try:

~/bitcoinaddress/bitcoinaddress/key/key.py in _from_seed(self, seed)
     77         self._generate_digest()
     78         self._generate_hex()
---> 79         self.mainnet.generate_wif()
     80         self.mainnet.generate_wif_compressed()
     81         self.testnet.generate_wif()

~/bitcoinaddress/bitcoinaddress/key/key.py in generate_wif(self)
     28 
     29         def generate_wif(self):
---> 30             self.wif = self.instance._generate_wif(Key.MainNet.PREFIX)
     31 
     32         def generate_wif_compressed(self):

~/bitcoinaddress/bitcoinaddress/key/key.py in _generate_wif(self, prefix)
    110         digest = prefix + self.digest
    111         c = checksum(digest)
--> 112         return base58.b58encode(digest + c).decode('utf-8')
    113 
    114     def _generate_wif_compressed(self, prefix, suffix):

AttributeError: 'str' object has no attribute 'decode'

In [3]: 

from bitcoinaddress.

cryptofunallday avatar cryptofunallday commented on May 29, 2024

Which is fixed by removing the .decode('utf-8') in the key.py and address.py files that are referenced in the error messages, in case anyone hits this issue.

from bitcoinaddress.

fortesp avatar fortesp commented on May 29, 2024

Strange. I just tested it by creating a new venv and it works perfectly.
For instance:

python -m venv new_env
cd new_env
source bin/activate
pip install bitcoinaddress
python /path/to/test.py <---  with wallet = Wallet()

from bitcoinaddress.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.