richardkiss/pycoin

examples not working in 0.90a0

ParmuSingh opened this issue · 2 comments

pip installss v0.80 and the examples didn't work for that so I install the master branch which is 0.90a0. I installed it via pip.

I ran the follow code:

# pip install git+https://github.com/richardkiss/pycoin.git
from pycoin.networks.registry import network_for_netcode

network = network_for_netcode("BTC") # error at this line

key = network.keys.bip32_seed(b"foo")  # this is a terrible key because it's very guessable
print(key.hwif())
print(key.wif())
print(key.sec())
print(key.address())

I got the following error:```

Traceback (most recent call last):
File "E:\workspace_py\pycoin_try.py", line 5, in
network = network_for_netcode("BTC")
File "E:\Program Files\Python36\lib\site-packages\pycoin\networks\registry.py", line 20, in network_for_netcode
module = importlib.import_module("%s.%s" % (prefix, netcode))
File "E:\Program Files\Python36\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in call_with_frames_removed
File "E:\Program Files\Python36\lib\site-packages\pycoin\symbols\btc.py", line 1, in
from pycoin.networks.bitcoinish import create_bitcoinish_network
File "E:\Program Files\Python36\lib\site-packages\pycoin\networks\bitcoinish.py", line 3, in
from pycoin.coins.bitcoin.Tx import Tx
File "E:\Program Files\Python36\lib\site-packages\pycoin\coins\bitcoin\Tx.py", line 7, in
from .Solver import BitcoinSolver as Solver
File "E:\Program Files\Python36\lib\site-packages\pycoin\coins\bitcoin\Solver.py", line 185, in
from .SolutionChecker import BitcoinSolutionChecker
File "E:\Program Files\Python36\lib\site-packages\pycoin\coins\bitcoin\SolutionChecker.py", line 2, in
from .VM import BitcoinVM
File "E:\Program Files\Python36\lib\site-packages\pycoin\coins\bitcoin\VM.py", line 3, in
from pycoin.ecdsa.secp256k1 import secp256k1_generator
File "E:\Program Files\Python36\lib\site-packages\pycoin\ecdsa\secp256k1.py", line 3, in
from .native.secp256k1 import LibSECP256K1Optimizations
File "E:\Program Files\Python36\lib\site-packages\pycoin\ecdsa\native\secp256k1.py", line 78, in
libsecp256k1 = load_library()
File "E:\Program Files\Python36\lib\site-packages\pycoin\ecdsa\native\secp256k1.py", line 36, in load_library
secp256k1 = ctypes.cdll.LoadLibrary(library_path)
File "E:\Program Files\Python36\lib\ctypes_init
.py", line 426, in LoadLibrary
return self.dlltype(name)
File "E:\Program Files\Python36\lib\ctypes_init
.py", line 348, in init
self._handle = _dlopen(self._name, mode)
TypeError: LoadLibrary() argument 1 must be str, not None

Looks like a Windows-specific problem.

Give it a try now. I don't automatically test the examples, so they break often. But I've fixed this particular issue (which would affect more than the examples on Windows).