1

I'm starting with python-bitcoinrpc from J.Garzik.

I'm using to try it the code provided by James D'Angelo (from Bitcoin 101 on youtube):

Apparently, there were some major changes with python-bitcoinrpc, not taken into account by old tutorial as the ones from James since you don't do now:

from bitcoinrpc.util import *
from bitcoinrpc.exceptions import *
from bitcoinrpc.__init__ import *
from bitcoinrpc.config import *
from bitcoinrpc.proxy import *
from bitcoinrpc.data import *
from bitcoinrpc.connection import *

bitcoin = connect_to_local()
NEW_ADDRESS = bitcoin.getnewaddress()
print(NEW_ADDRESS)

But now:

from bitcoinrpc.authproxy import AuthServiceProxy

access = AuthServiceProxy() 
info = access.getinfo() # Not WORKING: info is None

That's okay for me, and very shorter.

The problem is to get access.getinfo()to a variable? According to the README from python-bitcoinrpc, you can use the logging module to print stderr to the screen

logging.basicConfig()
logging.getLogger("BitcoinRPC").setLevel(logging.DEBUG)

rpc_connection = AuthServiceProxy("http://%s:%s@127.0.0.1:8332"%(rpc_user, rpc_password))
print(rpc_connection.getinfo())

But how do you put that into a variable?? Like with:

info = access.getinfo() (which is not working: infois None

2

Okay, there's a bug in the pip version of python-bitcoinrpc...

use pip install git+https://github.com/jgarzik/python-bitcoinrpc.git instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.