python-bitcoinrpc: modulenotfounderror no module named 'bitcoinrpc'

0

I'm running bitcoind/ bitcoind -regtest on Windows 10 and am already able to use bitcoin-cli -regtest along with json-rpc methods to perform basic operations and get balances etc. When I try to do this programmatically on python 3 using Jeff Garzik's python-bitcoinrpc package (https://github.com/jgarzik/python-bitcoinrpc) I get a modulenotfounderror. However, my pip3 freeze shows python-bitcoinlib==0.10.1 and also python-bitcoinrpc==1.0.

My code is below (18443 is the regtest port):

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException

rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:18443"%("myrpcuser","myrpcpassword"))

best_block_hash = rpc_connection.getbestblockhash() print(rpc_connection.getblock(best_block_hash))

What am I doing wrong?

Separately, is there a way to make the json-rpc calls into bitcoind directly from python3 instead of using this library, since it seems really old and out of use? Very grateful for your kind help!

oktested

Posted 2019-03-15T10:47:16.197

Reputation: 11

Are you sure your script is running with python3 an not python2? On many OS's, the default python is still python2.Andrew Chow 2019-03-15T17:36:05.660

Yes sir, I downloaded and used python3. I installed the package using pip3 install python-bitcoinrpc. Is there something else I should be doing? Appreciate your help to a noob.oktested 2019-03-16T03:52:44.160

No answers